feat: multi-stage dockerfile

This commit is contained in:
Nicolas Giard 2018-11-03 22:07:00 -04:00
parent fb29dd511b
commit 87840558f5

View File

@ -1,14 +1,43 @@
# ====================
# --- Build Assets ---
# ====================
FROM node:10-alpine AS assets
RUN apk update && \
apk add yarn g++ make python --no-cache && \
rm -rf /var/cache/apk/* && \
mkdir -p /var/wiki
WORKDIR /var/wiki
COPY ./package.json /var/wiki/package.json
COPY ./client /var/wiki/client
RUN yarn
RUN yarn build
RUN rm -rf /var/wiki/node_modules
RUN yarn --production
# ===============
# --- Release ---
# ===============
FROM node:10-alpine FROM node:10-alpine
LABEL maintainer="requarks.io" LABEL maintainer="requarks.io"
RUN apk update && \ RUN apk update && \
apk add bash curl git openssh supervisor --no-cache && \ apk add bash curl git openssh supervisor --no-cache && \
rm -rf /var/cache/apk/* && \
mkdir -p /var/wiki mkdir -p /var/wiki
WORKDIR /var/wiki WORKDIR /var/wiki
COPY supervisord.conf /etc/supervisord.conf COPY ./dev/build/supervisord.conf /etc/supervisord.conf
COPY . /var/wiki COPY --from=assets /var/wiki/assets ./assets
COPY --from=assets /var/wiki/node_modules ./node_modules
COPY ./server /var/wiki/server
COPY ./config.sample.yml /var/wiki/config.yml
COPY ./package.json /var/wiki/package.json
COPY ./LICENSE /var/wiki/LICENSE
EXPOSE 3000 EXPOSE 3000