* Always run yarn only on build platform with --platform=$BUILDPLATFORM * Remove optional dependencies (playwright + chromium) from build with --ignore-optional and move some devDependencies to be optional * Disable husky pre-commit hook checks on frontend Co-authored-by: sua yoo <sua@suayoo.com>
		
			
				
	
	
		
			54 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
# syntax=docker/dockerfile:1.4
 | 
						|
ARG RWP_BASE_URL=https://cdn.jsdelivr.net/npm/replaywebpage/
 | 
						|
 | 
						|
FROM --platform=$BUILDPLATFORM docker.io/library/node:16 as build_deps
 | 
						|
 | 
						|
WORKDIR /app
 | 
						|
COPY yarn.lock package.json ./
 | 
						|
# Uses `yarn cache clean` to let Docker cache layer instead
 | 
						|
# of including yarn cache in the build image
 | 
						|
RUN yarn --production --frozen-lockfile --ignore-optional --network-timeout 1000000 && \
 | 
						|
    yarn cache clean
 | 
						|
 | 
						|
COPY --link lit-localize.json \
 | 
						|
    postcss.config.js \
 | 
						|
    tailwind.config.js \
 | 
						|
    tsconfig.json \
 | 
						|
    webpack.config.js \
 | 
						|
    webpack.prod.js \
 | 
						|
    index.d.ts \
 | 
						|
    ./
 | 
						|
 | 
						|
COPY --link src ./src/
 | 
						|
 | 
						|
# Build variables used to show current app version
 | 
						|
# in the UI. Note that this will invalidate all
 | 
						|
# subsequent RUN steps.
 | 
						|
ARG GIT_COMMIT_HASH
 | 
						|
ARG GIT_BRANCH_NAME
 | 
						|
ARG VERSION
 | 
						|
ARG RWP_BASE_URL
 | 
						|
 | 
						|
ENV GIT_COMMIT_HASH=${GIT_COMMIT_HASH} \
 | 
						|
    GIT_BRANCH_NAME=${GIT_BRANCH_NAME} \
 | 
						|
    VERSION=${VERSION} \
 | 
						|
    RWP_BASE_URL=${RWP_BASE_URL}
 | 
						|
 | 
						|
# Prevent Docker image including node_modules to save space
 | 
						|
RUN yarn build && \
 | 
						|
  rm -rf ./node_modules
 | 
						|
 | 
						|
FROM docker.io/library/nginx:1.23.2
 | 
						|
 | 
						|
ARG RWP_BASE_URL
 | 
						|
ENV RWP_BASE_URL=${RWP_BASE_URL}
 | 
						|
 | 
						|
COPY --link --from=build_deps /app/dist /usr/share/nginx/html
 | 
						|
 | 
						|
#COPY ./nginx.conf /etc/nginx/nginx.conf
 | 
						|
COPY --link ./frontend.conf.template /etc/nginx/templates/
 | 
						|
COPY --link ./minio.conf /etc/nginx/includes/
 | 
						|
 | 
						|
ADD --link ./00-browsertrix-nginx-init.sh ./docker-entrypoint.d/
 | 
						|
 |