Initial commit
This commit is contained in:
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
# stage: dev
|
||||
FROM node:15-alpine as dev
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
|
||||
# stage: build
|
||||
FROM dev as build
|
||||
RUN npm prune --production
|
||||
|
||||
# stage: production
|
||||
FROM node:15-alpine as production
|
||||
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
|
||||
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
COPY --from=build /app/src ./src
|
||||
COPY --from=build /app/*.json ./
|
||||
COPY --from=build /app/*.ts ./
|
||||
|
||||
ENTRYPOINT [ "./docker-entrypoint.sh" ]
|
||||
CMD [ "npm", "start" ]
|
Reference in New Issue
Block a user