setting up the docker with dockerfiles💀😭😭

This commit is contained in:
Just-Simon-Dev committed 2023-05-26 21:42:54 +02:00
1 parent f43735e2cb
commit 0df546a6cb
4 files changed
+95

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
FROM node:20-alpine3.16 AS build
WORKDIR /backend
RUN npm install yarn
COPY . .
RUN yarn install --frozen-lockfile
RUN npm run build
CMD [ "npm", "run", "prod" ]
+19
View File
@@ -0,0 +1,19 @@
FROM node:20-alpine3.16 AS build
WORKDIR /dist/src/app
RUN npm cache clean --force
COPY . .
RUN npm install
RUN npm run build --prod
FROM nginx:latest AS ngi
COPY --from=build /dist/src/app/dist/frontend /usr/share/nginx/html
# COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
+49
View File
@@ -0,0 +1,49 @@
version: '3.14'
services:
nginx:
image: nginx:latest
build:
context: ./apps/frontend
dockerfile: ./Dockerfile
ports:
- 80:80
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
networks:
- city_tracker_network
depends_on:
- backend
backend:
container_name: backend
build:
context: ./apps/backend/
dockerfile: ./Dockerfile
ports:
- "3000:3000"
networks:
- city_tracker_network
postgres:
container_name: postgres_1
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
expose:
- 5432
environment:
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=admin!
- POSTGRES_DB=city_tracker_db
networks:
- city_tracker_network
volumes:
postgres_data:
networks:
city_tracker_network:
driver: bridge
+16
View File
@@ -0,0 +1,16 @@
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html =404;
}
location /api/ {
proxy_pass http://backend:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}