Skip to content

Commit 1ad3f6e

Browse files
committed
config docker file
1 parent 7b66d70 commit 1ad3f6e

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

DockerFile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# Copy entrypoint script
2-
COPY entrypoint.sh /entrypoint.sh
3-
RUN chmod +x /entrypoint.sh
1+
# Stage 1: build Angular app
2+
FROM node:20-alpine AS build
3+
WORKDIR /app
4+
COPY package*.json ./
5+
RUN npm install
6+
COPY . .
7+
RUN npm run build --prod
48

5-
ENTRYPOINT ["/entrypoint.sh"]
9+
# Stage 2: serve với Nginx
10+
FROM nginx:alpine
11+
COPY --from=build /app/dist/codecampus /usr/share/nginx/html
12+
# copy sẵn default nginx config nếu cần
13+
COPY nginx.conf /etc/nginx/conf.d/default.conf

docker-compose.prod-frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
container_name: codecampus-frontend
66
image: ${DOCKERHUB_USER}/codecampus-frontend:${IMAGE_TAG:-latest}
77
restart: unless-stopped
8-
ports: ["4200:4200"]
8+
ports: ["4200:80"]
99
volumes:
1010
# Dùng config local
1111
- ./config-local.json:/usr/share/nginx/html/config.json

entrypoint.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)