File tree Expand file tree Collapse file tree 6 files changed +8
-14
lines changed Expand file tree Collapse file tree 6 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,6 @@ services:
16
16
build :
17
17
context : ./user-service
18
18
dockerfile : Dockerfile
19
- args :
20
- DB_CLOUD_URI : ${DB_CLOUD_URI}
21
- JWT_SECRET : ${JWT_SECRET}
22
19
ports :
23
20
- 3001:3001
24
21
networks :
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ You can start editing the page by modifying `app/page.tsx`. The page auto-update
42
42
``` sh
43
43
# Navigate to the frontend app directory
44
44
cd apps/frontend
45
+
45
46
# Build dockerfile (Ensure that your docker daemon is running beforehand)
46
47
docker build -t frontend -f Dockerfile .
47
48
```
@@ -52,7 +53,7 @@ Run the backend server locally and visit http://localhost:3000/ to see the front
52
53
53
54
``` sh
54
55
# Run the docker image, the -d tag is to run it detached
55
- docker run -p 3000:3000 -d frontend -e NEXT_PUBLIC_QUESTION_SERVICE_URL= " http://localhost:8080/ "
56
+ docker run -p 3000:3000 --env-file .env -d frontend
56
57
57
58
# To see the running container
58
59
docker ps
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ WORKDIR /usr/src/app
4
4
5
5
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
6
6
COPY go.mod go.sum ./
7
+
7
8
RUN go mod tidy && go mod download && go mod verify
8
9
9
10
COPY . .
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ docker build -t question-service .
58
58
```
59
59
60
60
``` bash
61
- docker run -p 8080:8080 -d question-service
61
+ docker run -p 8080:8080 --env-file .env - d question-service
62
62
```
63
63
64
64
The server will be available at http://localhost:8080 .
Original file line number Diff line number Diff line change 1
1
FROM node:20-alpine AS base
2
2
3
- ARG DB_CLOUD_URI
4
- ARG JWT_SECRET
5
- ENV DB_CLOUD_URI=${DB_CLOUD_URI}
6
- ENV JWT_SECRET=${JWT_SECRET}
7
- ENV ENV=PROD
8
-
9
3
FROM base AS deps
10
4
11
5
WORKDIR /app
Original file line number Diff line number Diff line change 286
286
```bash
287
287
# Navigate to the user-service app directory
288
288
cd apps/user-service
289
- # Build dockerfile after replacing the build arguments (Ensure that your docker daemon is running beforehand)
290
- docker build -t user-service --build-arg JWT_SECRET='replace_with_jwt_secret' --build-arg DB_CLOUD_URI='replace_with_db_uri_here' -f Dockerfile .
289
+
290
+ # Build dockerfile (Ensure that your docker daemon is running beforehand)
291
+ docker build -t user-service -f Dockerfile .
291
292
```
292
293
293
294
### Running Docker
294
295
295
296
``` bash
296
297
# Run the docker image, the -d tag is to run it detached
297
- docker run -p 3001:3001 -d user-service
298
+ docker run -p 3001:3001 --env-file .env - d user-service
298
299
299
300
# To check the container information
300
301
docker ps
You can’t perform that action at this time.
0 commit comments