Skip to content

Commit

Permalink
Fix Dockerfile and compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
usatie committed Oct 26, 2023
1 parent 0faced3 commit b848705
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ down:
build:
docker compose build

.PHONY: rebuild
rebuild:
docker compose build --no-cache

.PHONY: clean
clean:
docker compose down --rmi all --volumes --remove-orphans

.PHONY: test
test:
test: build
# Unit tests for backend
docker compose -f compose.yml -f compose.dev.yml run backend sh -c "yarn test"
# E2E tests for backend
Expand All @@ -32,9 +36,9 @@ e2e:
./test.sh

.PHONY: dev
dev:
dev: build
docker compose -f compose.yml -f compose.dev.yml up -d

.PHONY: prod
prod: clean build
prod: clean rebuild
docker compose -f compose.yml -f compose.prod.yml up -d
5 changes: 2 additions & 3 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules
Dockerfile
dist
**/node_modules
**/dist
6 changes: 5 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ FROM node:20

WORKDIR /app

COPY package.json yarn.lock ./
COPY prisma ./prisma/
RUN yarn install && yarn prisma generate

COPY . .

RUN yarn install && yarn build
RUN yarn build
7 changes: 6 additions & 1 deletion compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ services:
- ./web/html:/var/www/playground
- ./web/nginx.conf:/etc/nginx/nginx.conf
backend:
command: sh -c "yarn install && yarn build && yarn prisma migrate deploy && yarn start:dev"
volumes:
- ./backend:/app
- backend-node-modules:/app/node_modules
frontend:
volumes:
- ./frontend:/app
- frontend-node-modules:/app/node_modules

volumes:
frontend-node-modules:
backend-node-modules:
4 changes: 2 additions & 2 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
Dockerfile
**/node_modules
**/dist
5 changes: 3 additions & 2 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM node:20

WORKDIR /app

COPY . .

COPY package.json ./
RUN npm install

COPY . .

0 comments on commit b848705

Please sign in to comment.