Using multistage builds with protocol buffers

pull/280/head
David Négrier 2 years ago
parent d3116c7400
commit d2a5060ad2
  1. 8
      back/Dockerfile
  2. 8
      front/Dockerfile

@ -1,9 +1,13 @@
FROM thecodingmachine/workadventure-back-base:latest as builder
WORKDIR /var/www/messages
COPY --chown=docker:docker messages .
RUN yarn install && yarn proto
FROM thecodingmachine/nodejs:12
COPY --chown=docker:docker back .
COPY --chown=docker:docker messages ../messages
COPY --from=builder --chown=docker:docker /var/www/messages /var/www/messages
RUN yarn install
RUN cd /usr/src/messages && yarn install && yarn proto
ENV NODE_ENV=production

@ -1,10 +1,14 @@
FROM thecodingmachine/workadventure-back-base:latest as builder
WORKDIR /var/www/messages
COPY --chown=docker:docker messages .
RUN yarn install && yarn proto
# we are rebuilding on each deploy to cope with the API_URL environment URL
FROM thecodingmachine/nodejs:14-apache
COPY --chown=docker:docker front .
COPY --chown=docker:docker messages /var/www/messages
COPY --from=builder --chown=docker:docker /var/www/messages /var/www/messages
RUN yarn install
RUN cd /var/www/messages && yarn install && yarn proto
ENV NODE_ENV=production
ENV STARTUP_COMMAND_1="yarn run build"

Loading…
Cancel
Save