Skip to content

Commit 1936ed7

Browse files
committed
chore: update dockerfile, ports and README instructions
1 parent 07ef661 commit 1936ed7

File tree

5 files changed

+9
-16
lines changed

5 files changed

+9
-16
lines changed

Dockerfile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,23 @@ ENV NODE_ENV=$MODE
88
# Create app dir
99
WORKDIR /app
1010

11-
# Copy all project
12-
COPY . .
13-
1411
# Install concurrently
1512
RUN npm install -g concurrently
1613

17-
# Setting backend deps
14+
# Copy backend dependencies
15+
COPY package*.json ./
1816
RUN npm install
1917

20-
# Setup frontend deps
18+
# Copy frontend dependencies
19+
COPY frontend/package*.json ./frontend/
2120
RUN cd frontend && npm install
2221

23-
24-
RUN if [ "$MODE" = "prod" ]; then \
25-
cd frontend && npm run build; \
26-
fi
22+
COPY . .
2723

2824
# Expose frontend (3000) và backend (3004)
2925
EXPOSE 3000
3026
EXPOSE 3004
3127

32-
# Start mode
3328
CMD sh -c 'if [ "$MODE" = "dev" ]; then concurrently "cd frontend && npm start" "npm run start-dev"; else npm run start; fi'
3429

3530

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ If the port is changed, please make sure the `PORT` environment variable and Doc
316316
<strong>Run in Production</strong>
317317

318318
```bash
319-
docker compose -f docker-compose.prod.yml up --build -d
319+
docker compose -f docker-compose.prod.yml up --build
320320
```
321321

322322
#### Access the app

docker-compose.prod.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ services:
66
args:
77
MODE: prod
88
ports:
9-
- "3000:${PORT:-3000}"
9+
- "${PORT:-3000}:${PORT:-3000}"
1010
env_file:
1111
- .env
12-
environment:
13-
- NODE_ENV=production
1412
restart: always

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
- /app/node_modules
1212
ports:
1313
- "3004:3004"
14-
- "5173:5173"
14+
- "3000:3000"
1515
environment:
1616
- MODE=dev
1717
- NODE_ENV=DEVELOPMENT

src/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const initiateServer = async () => {
1515

1616
app.use(morgan("dev"));
1717

18-
if (process.env.NODE_ENV === "production") {
18+
if (process.env.NODE_ENV === "PRODUCTION") {
1919
app.use(express.static(path.join(__dirname, "../", "frontend", "build")));
2020

2121
app.get("/*", (req, res) => {

0 commit comments

Comments
 (0)