deployment artifacts
This commit is contained in:
1 parent
5c3d5e4bf7
commit
4c221e2348
3 files changed
+64
No files matched your search
+14
@@ -0,0 +1,14 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
# Xóa file cấu hình mặc định của Nginx
|
||||
RUN rm -rf /etc/nginx/conf.d/*
|
||||
|
||||
# Copy file cấu hình tùy chỉnh của bạn vào
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copy source code web và thư mục ảnh vào
|
||||
COPY index.html /usr/share/nginx/html/
|
||||
COPY images/ /usr/share/nginx/html/images/
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -0,0 +1,20 @@
|
||||
networks:
|
||||
proxy_tier:
|
||||
name: proxy_tier
|
||||
external: true
|
||||
|
||||
services:
|
||||
nha-trang-web:
|
||||
image: nha-trang-site:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: nha-trang-app
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.kyduyen.rule=Host(`kyduyen.quangkhai.ch`)"
|
||||
- "traefik.http.routers.kyduyen.tls.certresolver=myresolver"
|
||||
- "traefik.http.services.kyduyen.loadbalancer.server.port=80"
|
||||
networks:
|
||||
- proxy_tier
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# Thư mục gốc chứa mã nguồn website trong container
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
# Cấu hình nén để website tải nhanh hơn
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
gzip_min_length 1000;
|
||||
|
||||
# Xử lý các request chính
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
# Tối ưu cache cho các file tĩnh (hình ảnh, CSS, JS) để tăng tốc độ tải trang
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
|
||||
# Trang lỗi tùy chỉnh (tùy chọn)
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user