*: Dockerfiles cleanup, docker-compose.prod.yaml
New docker-compose.prod.yaml should provide a production-ish deployment of WorkAdventure
This commit is contained in:
parent
c2d0cda441
commit
33b9bd773f
11 changed files with 183 additions and 31 deletions
|
@ -1,15 +1,26 @@
|
|||
FROM thecodingmachine/workadventure-back-base:latest as builder
|
||||
WORKDIR /var/www/messages
|
||||
COPY --chown=docker:docker messages .
|
||||
# protobuf build
|
||||
FROM node:14.15.4-buster-slim@sha256:cbae886186467bbfd274b82a234a1cdfbbd31201c2a6ee63a6893eefcf3c6e76 as builder
|
||||
WORKDIR /usr/src
|
||||
COPY messages .
|
||||
RUN yarn install && yarn proto
|
||||
|
||||
FROM thecodingmachine/nodejs:12
|
||||
|
||||
COPY --chown=docker:docker pusher .
|
||||
COPY --from=builder --chown=docker:docker /var/www/messages/generated /usr/src/app/src/Messages/generated
|
||||
# typescript build
|
||||
FROM node:14.15.4-buster-slim@sha256:cbae886186467bbfd274b82a234a1cdfbbd31201c2a6ee63a6893eefcf3c6e76 as builder2
|
||||
WORKDIR /usr/src
|
||||
COPY pusher/yarn.lock pusher/package.json ./
|
||||
RUN yarn install
|
||||
|
||||
COPY pusher .
|
||||
COPY --from=builder /usr/src/generated src/Messages/generated
|
||||
ENV NODE_ENV=production
|
||||
RUN yarn run tsc
|
||||
|
||||
# final production image
|
||||
FROM node:14.15.4-buster-slim@sha256:cbae886186467bbfd274b82a234a1cdfbbd31201c2a6ee63a6893eefcf3c6e76
|
||||
WORKDIR /usr/src
|
||||
COPY pusher/yarn.lock pusher/package.json ./
|
||||
COPY --from=builder2 /usr/src/dist /usr/src/dist
|
||||
ENV NODE_ENV=production
|
||||
RUN yarn install --production
|
||||
|
||||
USER node
|
||||
CMD ["yarn", "run", "runprod"]
|
||||
|
|
17
pusher/Dockerfile.prod
Normal file
17
pusher/Dockerfile.prod
Normal file
|
@ -0,0 +1,17 @@
|
|||
FROM node:12.19.0-slim
|
||||
|
||||
RUN mkdir -p /home/node/app && chown -R node:node /home/node/app
|
||||
WORKDIR /home/node/app
|
||||
|
||||
USER node
|
||||
ENV NODE_ENV=production
|
||||
ENV DEBUG=*
|
||||
|
||||
COPY --chown=node:node package.json yarn.lock ./
|
||||
|
||||
RUN yarn install --prod --frozen-lockfile
|
||||
|
||||
COPY --chown=node:node ./dist/ ./dist/
|
||||
|
||||
EXPOSE 8080
|
||||
CMD ["yarn", "run", "runprod"]
|
Loading…
Add table
Add a link
Reference in a new issue