Update Dockerfile

This commit is contained in:
Matt Low 2021-02-25 00:38:11 -07:00
parent ae9016fbf6
commit 1ff71d099e

View File

@ -1,7 +1,6 @@
# dev stage
FROM node:14-alpine as dev
WORKDIR /app
RUN apk update && apk add --no-cache python3 make gcc g++
COPY package*.json ./
RUN npm ci
COPY . .
@ -14,21 +13,13 @@ RUN npx tsc && npm prune --production
FROM node:14-alpine
WORKDIR /app
RUN printf "%b" '#!'"/bin/sh\n\
set -e\n\
if [ ! -z \"\$RUN_MIGRATIONS\" ]; then\n\
echo \"Running migrations.\"\n\
npm run knex:migrate:latest\n\
fi\n\
exec \"\$@\"\n" > docker-entrypoint.sh && chmod +x docker-entrypoint.sh
RUN apk add --update --no-cache util-linux
# Copy over production modules and dist folder
COPY --from=build /app/package*.json ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=build /app/db ./db
EXPOSE 4000
ENTRYPOINT [ "./docker-entrypoint.sh" ]
CMD [ "node", "dist/main.js" ]