Skip to content

Commit 34cd13c

Browse files
committed
Update deploy fe
1 parent 210c760 commit 34cd13c

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

.github/workflows/frontend-docker-publish.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,9 @@ jobs:
7171
tags: ${{ steps.meta.outputs.tags }}
7272
cache-from: type=gha
7373
cache-to: type=gha,mode=max
74+
75+
- name: Smoke test image content
76+
run: |
77+
IMG="${{ env.DOCKER_REPO }}:${IMAGE_TAG}"
78+
docker pull "$IMG"
79+
docker run --rm "$IMG" sh -lc 'test -f /usr/share/nginx/html/index.html && ls -lah /usr/share/nginx/html | head -n 50'

docker/angular-frontend.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN npm ci
1010
COPY . .
1111

1212
# Build production và cố định output-path để tránh lệ thuộc tên project
13-
RUN npm run build -- --configuration=production --output-path=dist/app
13+
RUN npm run build -- --configuration=production
1414

1515
# ====== Runtime stage ======
1616
FROM nginx:1.27-alpine
@@ -22,7 +22,7 @@ COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
2222
RUN rm -rf /usr/share/nginx/html/*
2323

2424
# copy artefact Angular
25-
COPY --from=build /app/dist/app/ /usr/share/nginx/html/
25+
COPY --from=build /app/dist/codecampus/ /usr/share/nginx/html/
2626

2727
EXPOSE 80
2828
HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD wget -qO- http://localhost/ || exit 1

docker/nginx.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ server {
55
root /usr/share/nginx/html;
66
index index.html;
77

8+
# # Proxy API -> gateway-service
9+
# location /api/ {
10+
# proxy_pass http://gateway-service:8888/api/;
11+
# proxy_set_header Host $host;
12+
# proxy_set_header X-Real-IP $remote_addr;
13+
# proxy_http_version 1.1;
14+
# proxy_set_header Connection "";
15+
# }
16+
817
# Cache tĩnh nhẹ nhàng
918
location ~* \.(?:js|css|png|jpg|jpeg|gif|svg|ico|woff2?)$ {
1019
try_files $uri =404;

test.bash

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# các biến của bạn
2+
IMG=""
3+
4+
docker rm -f codecampus-frontend 2>/dev/null || true
5+
docker run -d --name codecampus-frontend ^
6+
--restart unless-stopped ^
7+
-p 4200:80 ^
8+
yunomix2834/codecampus-frontend:latest
9+
10+
# kiểm tra
11+
docker logs -n 50 codecampus-frontend
12+
curl -I http://localhost:4200

0 commit comments

Comments
 (0)