feat: fix db script exec order, onlyl use back-end.env files

This commit is contained in:
Nemo D'ACREMONT 2024-11-23 11:53:52 +01:00
parent bbf7a292ad
commit 690a242a78
No known key found for this signature in database
GPG Key ID: 6E5BCE8022FA8276
10 changed files with 8 additions and 11 deletions

View File

@ -1,6 +0,0 @@
NODE_PORT=3000
NODE_ENV=dev
DB_HOST=localhost
DB_NAME=briques_db
DB_USER=briques_llm
DB_PASSWORD=briques_password_2025

View File

@ -3,5 +3,4 @@ FROM postgres:17
WORKDIR /db
# postgresql will execute the files in that folder after build
COPY create.sql drop.sql insert.sql select.sql update.sql /docker-entrypoint-initdb.d/
COPY build/* /docker-entrypoint-initdb.d/

View File

@ -6,11 +6,12 @@ WORKDIR /usr/src/back
# Copy sources
COPY . .
COPY .env.production .env
# install deps, and pm2 to run the app
RUN npm install
RUN npm install -g pm2
# RUN npm install -g pm2
COPY .env.production .env
# Compilation des fichiers TypeScript
RUN npm run build
@ -23,4 +24,5 @@ RUN chmod -R u=rwx,g=,o= ./
EXPOSE 3000
# Start app
CMD ["pm2", "start", "dist/app.js", "--no-daemon"]
CMD ["npm", "run", "startonly"]
# CMD ["pm2", "start", "dist/app.js", "--no-daemon"]

View File

@ -2,6 +2,7 @@ services:
database:
hostname: database
container_name: briques_postgres
env_file: back-end/.env
build:
context: ./PostgreSQL
dockerfile: Dockerfile

View File

@ -6,6 +6,7 @@ services:
context: ./PostgreSQL
dockerfile: Dockerfile
restart: always
env_file: back-end/.env.production
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}