Skip to content

Commit

Permalink
fix: volume
Browse files Browse the repository at this point in the history
  • Loading branch information
orig committed Sep 14, 2023
1 parent 820d302 commit 8252c83
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
9 changes: 6 additions & 3 deletions apps/backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Dockerfile
.dockerignore
node_modules
dist
npm-debug.log
dist
CONTRIBUTE.MD
README.md
.gitignore
LICENSE
.DS_Store
15 changes: 10 additions & 5 deletions apps/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Dependencies Stage
# --------------------------------------------
FROM node:19.2-alpine3.15 as dependencies

WORKDIR /app
COPY package.json package-lock.json ./

COPY package*.json ./

RUN apk add --update python3 make g++\
&& rm -rf /var/cache/apk/*
Expand Down Expand Up @@ -32,12 +32,17 @@ FROM node:19.2-alpine3.15 as production
WORKDIR /app

COPY --from=build /app/dist/apps/backend ./backend
COPY --from=build /app/dist/libs/prisma ./prisma
COPY --from=build /app/node_modules ./node_modules
COPY ./libs/ ./libs/
COPY ./nx.json ./nx.json
COPY --from=build /app/libs/ ./libs

EXPOSE 3000

# Start the application
CMD sh -c "npx nx migrate-deploy prisma && node backend/main.js"







6 changes: 2 additions & 4 deletions apps/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
# Dependencies Stage
# --------------------------------------------
FROM node:19.2-alpine3.15 as dependencies

WORKDIR /app
COPY package.json package-lock.json ./

COPY package*.json ./

RUN apk add --update python3 make g++\
&& rm -rf /var/cache/apk/*

RUN npm ci


# --------------------------------------------
# Build Stage
# --------------------------------------------
Expand All @@ -31,7 +30,6 @@ COPY --from=dependencies /app/node_modules ./node_modules
# Run prisma generate & build the bundle in production mode
RUN npx nx build frontend --prod --skip-nx-cache


# --------------------------------------------
# Production Stage
# --------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions docker/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ services:
restart: always
ports:
- '3000:3000'
volumes:
- ../../:/app/
env_file: ../../.env
depends_on:
- postgres
Expand Down
1 change: 0 additions & 1 deletion libs/config/src/lib/config.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { AppConfigService } from './config.service';
imports: [
ConfigModule.forRoot({
isGlobal: true,
envFilePath: ['../../.env'],
load: [configFactory],
cache: true,
}),
Expand Down
8 changes: 2 additions & 6 deletions libs/prisma/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@
"migrate-dev": {
"executor": "nx:run-commands",
"options": {
"command": "npx prisma migrate dev --schema=src/schema.prisma --name={args.name}",
"cwd": "libs/prisma",
"envFile": "../../.env",
"command": "npx prisma migrate dev --schema=libs/prisma/src/schema.prisma --name={args.name}",
"parallel": true
}
},
"migrate-deploy": {
"executor": "nx:run-commands",
"options": {
"command": "npx prisma migrate deploy --schema=src/schema.prisma",
"cwd": "libs/prisma",
"envFile": "../../.env",
"command": "npx prisma migrate deploy --schema=libs/prisma/src/schema.prisma",
"parallel": true
}
},
Expand Down

0 comments on commit 8252c83

Please sign in to comment.