Initial commit: LACA parking management system
This commit is contained in:
44
backend/deploy/api/Dockerfile
Normal file
44
backend/deploy/api/Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
||||
# PRODUCTION DOCKERFILE
|
||||
# ---------------------
|
||||
# This Dockerfile allows to build a Docker image of the NestJS application
|
||||
# and based on a NodeJS 20 image. The multi-stage mechanism allows to build
|
||||
# the application in a "builder" stage and then create a lightweight production
|
||||
# image containing the required dependencies and the JS build files.
|
||||
#
|
||||
# Dockerfile best practices
|
||||
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
|
||||
# Dockerized NodeJS best practices
|
||||
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
|
||||
# https://www.bretfisher.com/node-docker-good-defaults/
|
||||
# http://goldbergyoni.com/checklist-best-practice-of-node-js-in-production/
|
||||
|
||||
FROM node:16-alpine as builder
|
||||
|
||||
ENV NODE_ENV build
|
||||
|
||||
USER node
|
||||
WORKDIR /home/node
|
||||
|
||||
COPY ../../package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY --chown=node:node ../../. .
|
||||
|
||||
RUN npx prisma generate \
|
||||
&& npm run build \
|
||||
&& npm prune --omit=dev
|
||||
|
||||
# ---
|
||||
|
||||
FROM node:16-alpine as production
|
||||
|
||||
ENV NODE_ENV production
|
||||
|
||||
USER node
|
||||
WORKDIR /home/node
|
||||
|
||||
COPY --from=builder --chown=node:node /home/node/package*.json ./
|
||||
COPY --from=builder --chown=node:node /home/node/node_modules/ ./node_modules/
|
||||
COPY --from=builder --chown=node:node /home/node/dist/ ./dist/
|
||||
|
||||
CMD ["node", "dist/server.js"]
|
||||
0
backend/deploy/api/docker-compose.yaml
Normal file
0
backend/deploy/api/docker-compose.yaml
Normal file
40
backend/deploy/storage/docker-compose.yaml
Normal file
40
backend/deploy/storage/docker-compose.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
version: '3.8'
|
||||
|
||||
x-logging: &logging
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-file: "5"
|
||||
max-size: "10m"
|
||||
|
||||
x-network: &network
|
||||
network_mode: "host"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:13.5
|
||||
restart: always
|
||||
environment:
|
||||
- POSTGRES_USER=${DB_USER}
|
||||
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
<<: [ *logging ]
|
||||
|
||||
redis:
|
||||
hostname: redis
|
||||
container_name: redis
|
||||
image: redis:6.2.11-alpine
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
command: >
|
||||
--requirepass ${REDIS_PASSWORD}
|
||||
ports:
|
||||
- "6379:6379"
|
||||
<<: [ *logging ]
|
||||
|
||||
volumes:
|
||||
postgres:
|
||||
redis-data:
|
||||
Reference in New Issue
Block a user