Using multistage builds with protocol buffers

This commit is contained in:
David Négrier 2020-09-18 18:00:03 +02:00
parent d3116c7400
commit d2a5060ad2
2 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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"