Skip to content

Commit

Permalink
♻️ Refactor skeleton (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
usatie authored Oct 25, 2023
1 parent 3ebe40f commit 1f72654
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 15 deletions.
3 changes: 3 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
Dockerfile
dist
4 changes: 2 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM node:20

WORKDIR /app

COPY package.json ./
COPY . .

RUN yarn install
RUN yarn install && yarn build
14 changes: 14 additions & 0 deletions compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
services:
web:
volumes:
- ./web/html:/var/www/playground
- ./web/nginx.conf:/etc/nginx/nginx.conf
backend:
command: yarn start:dev
volumes:
- ./backend:/app
- backend_node_modules:/app/node_modules
frontend:
command: npm run dev
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules

volumes:
backend_node_modules:
frontend_node_modules:
2 changes: 0 additions & 2 deletions compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ services:
web:
ports:
- "80:80"
frontend:
command: npm run start
13 changes: 3 additions & 10 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
version: '3.9'
services:
web:
image: nginx:alpine
build: web
ports:
- "4242:80"
volumes:
- ./web/html:/var/www/playground
- ./web/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- backend
- frontend
frontend:
build: frontend
command: npm run start
depends_on:
- backend
backend:
build: backend
volumes:
- ./backend:/app
- backend_node_modules:/app/node_modules
command: yarn start
environment:
POSTGRES_USER: ${POSTGRES_USER}
Expand All @@ -32,6 +28,3 @@ services:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}

volumes:
backend_node_modules:
2 changes: 2 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
Dockerfile
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ FROM node:20
WORKDIR /app

COPY . .

RUN npm install && npm run build
CMD ["npm", "run", "start"]
4 changes: 4 additions & 0 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginx

COPY ./html /var/www/playground
COPY ./nginx.conf /etc/nginx/nginx.conf

0 comments on commit 1f72654

Please sign in to comment.