Docker multistage build #113

Merged
konrad merged 2 commits from jonastheis/frontend:feat/docker-multistage-build into master 2020-04-19 17:27:16 +00:00
1 changed files with 17 additions and 4 deletions

View File

@ -1,6 +1,16 @@
FROM nginx
# Stage 1: Build application
FROM node:13.13.0 AS compile-image
MAINTAINER maintainers@vikunja.io
WORKDIR /build
COPY . ./
RUN yarn install --frozen-lockfile

This should use yarn install --frozen-lockfile to take the dependencies from the lockfile and not modify the accidentially.

This should use `yarn install --frozen-lockfile` to take the dependencies from the lockfile and not modify the accidentially.
Review

I'm not a frontend guy and just copied the command.

Fixed with the latest commit.

I'm not a frontend guy and just copied the command. Fixed with the latest commit.
RUN yarn run build
# Stage 2: copy
FROM nginx
RUN apt-get update && apt-get install -y apt-utils openssl && \
mkdir -p /etc/nginx/ssl && \
@ -8,6 +18,9 @@ RUN apt-get update && apt-get install -y apt-utils openssl && \
openssl req -new -key /etc/nginx/ssl/dummy.key -out /etc/nginx/ssl/dummy.csr -subj "/C=DE/L=Berlin/O=Vikunja/CN=Vikunja Snakeoil" && \
openssl x509 -req -days 3650 -in /etc/nginx/ssl/dummy.csr -signkey /etc/nginx/ssl/dummy.key -out /etc/nginx/ssl/dummy.crt
ADD nginx.conf /etc/nginx/nginx.conf
COPY nginx.conf /etc/nginx/nginx.conf
COPY dist /usr/share/nginx/html
# copy compiled files from stage 1
COPY --from=compile-image /build/dist /usr/share/nginx/html
LABEL maintainer="maintainers@vikunja.io"