Skip to content
This repository was archived by the owner on Mar 12, 2022. It is now read-only.

Commit ad60b3e

Browse files
committedAug 19, 2021
docker build files
1 parent 6d2beff commit ad60b3e

File tree

5 files changed

+379
-264
lines changed

5 files changed

+379
-264
lines changed
 

‎Dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM node:lts-alpine AS production
2+
3+
ARG NODE_ENV=production
4+
ENV NODE_ENV=${NODE_ENV}
5+
6+
WORKDIR /usr/src/app
7+
8+
COPY . /usr/src/app
9+
10+
RUN apk update && \
11+
apk upgrade && \
12+
apk add --no-cache git
13+
14+
RUN yarn global add typescript && yarn global add @nestjs/cli && yarn global add ts-node
15+
RUN yarn install --production && yarn build
16+
17+
CMD ["node", "/dist/main"]
18+
19+
FROM node:lts-alpine AS development
20+
21+
ARG NODE_ENV=development
22+
ENV NODE_ENV=${NODE_ENV}
23+
24+
WORKDIR /usr/src/app
25+
26+
COPY . /usr/src/app
27+
28+
RUN apk update && \
29+
apk upgrade && \
30+
apk add --no-cache git
31+
32+
RUN yarn global add typescript && yarn global add @nestjs/cli && yarn global add ts-node
33+
RUN yarn && yarn build
34+
35+
CMD ["node", "/dist/main"]

‎docker-compose.yml

+38-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,50 @@
11
version: '3.8'
22

33
services:
4+
dev:
5+
container_name: aluraflix_dev
6+
build:
7+
context: .
8+
dockerfile: ./Dockerfile
9+
target: development
10+
depends_on:
11+
- db
12+
- redis
13+
env_file:
14+
- .env
15+
ports:
16+
- 3000:3000
17+
- 9229:9229
18+
command: npm run start:dev
19+
volumes:
20+
- .:/usr/src/app
21+
- /usr/src/app/node_modules
22+
prod:
23+
container_name: aluraflix_prod
24+
build:
25+
context: .
26+
dockerfile: ./Dockerfile
27+
target: production
28+
depends_on:
29+
- db
30+
- redis
31+
env_file:
32+
- .env
33+
ports:
34+
- 3000:3000
35+
- 9229:9229
36+
command: npm run start:prod
37+
volumes:
38+
- .:/usr/src/app
39+
- /usr/src/app/node_modules
440
db:
541
container_name: aluraflix_pgsql
642
image: postgres:alpine
743
restart: always
8-
env_file:
9-
- .env
1044
ports:
1145
- '5432:5432'
12-
pgadmin:
13-
container_name: pgadmin4_aluraflix
14-
image: dpage/pgadmin4
15-
restart: always
16-
environment:
17-
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
18-
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
19-
ports:
20-
- '5050:80'
46+
volumes:
47+
- /usr/src/app/aluraflix/docker-volumes/db/:/var/lib/postgresql/data
2148
redis:
2249
container_name: aluraflix-redis
2350
image: redis:alpine

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"supertest": "^6.1.3",
7070
"ts-jest": "^26.5.4",
7171
"ts-loader": "^8.0.18",
72-
"ts-node": "^9.1.1",
72+
"ts-node": "^10.2.1",
7373
"tsconfig-paths": "^3.9.0",
7474
"typescript": "^4.2.3"
7575
},

‎tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"target": "es2017",
1010
"sourceMap": true,
1111
"outDir": "./dist",
12-
"baseUrl": "./",
12+
"baseUrl": ".",
1313
"incremental": true
1414
}
1515
}

0 commit comments

Comments
 (0)