File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
2
+ .dockerignore
3
+ .git
4
+ .gitignore
5
+ .next
6
+ out
7
+ public
8
+ README.md
Original file line number Diff line number Diff line change 1
1
FROM node:18-alpine AS base
2
2
3
3
# For now we can specify it here, else we can use --build-arg in our docker build command
4
- ENV NEXT_PUBLIC_API_URL="http://localhost:8080/"
4
+ ARG NEXT_PUBLIC_API_URL
5
+ ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
5
6
6
7
# Install dependencies only when needed
7
8
FROM base AS deps
Original file line number Diff line number Diff line change @@ -42,7 +42,20 @@ You can start editing the page by modifying `app/page.tsx`. The page auto-update
42
42
# Navigate to the frontend app directory
43
43
cd apps/frontend
44
44
# Build dockerfile (Ensure that your docker daemon is running beforehand)
45
- docker build -t frontend -f Dockerfile .
45
+ docker build -t frontend --build-arg NEXT_PUBLIC_API_URL= " http://localhost:8080/ " - f Dockerfile .
46
46
```
47
47
48
48
Run the backend server locally and visit http://localhost:3000/ to see the frontend application working
49
+
50
+ ## Running Docker Image
51
+
52
+ ``` sh
53
+ # Run the docker image, the -d tag is to run it detached
54
+ docker run -p 3000:3000 -d frontend
55
+
56
+ # To see the running container
57
+ docker ps
58
+
59
+ # To stop the container, copy the container id from the previous command
60
+ docker stop < container_id>
61
+ ```
You can’t perform that action at this time.
0 commit comments