From b0325b46fe1f039938e2b723155193723444a266 Mon Sep 17 00:00:00 2001 From: heyli Date: Fri, 2 Feb 2024 19:59:25 +0800 Subject: [PATCH] feat: improve --- .github/workflows/docker-image.yml | 20 ++++++++++---------- Dockerfile | 3 +++ default.conf | 26 ++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 Dockerfile create mode 100644 default.conf diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 96ee317..d958109 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -25,17 +25,17 @@ jobs: - name: Set Timestamp run: echo "TIMESTAMP=$(date +%s%3N)" >> $GITHUB_ENV - - name: Fetch default.conf - uses: valitydev/action-download-file@v1 - with: - url: https://raw.githubusercontent.com/lcxfs1991/docschina-deployment/main/cdn/default.conf - target-path: . + # - name: Fetch default.conf + # uses: valitydev/action-download-file@v1 + # with: + # url: https://raw.githubusercontent.com/lcxfs1991/docschina-deployment/main/cdn/default.conf + # target-path: . - - name: Fetch Dockerfile - uses: valitydev/action-download-file@v1 - with: - url: https://raw.githubusercontent.com/lcxfs1991/docschina-deployment/main/cdn/Dockerfile - target-path: . + # - name: Fetch Dockerfile + # uses: valitydev/action-download-file@v1 + # with: + # url: https://raw.githubusercontent.com/lcxfs1991/docschina-deployment/main/cdn/Dockerfile + # target-path: . - name: Docker build uses: docker/setup-buildx-action@v3 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a775596 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:1.19.10-alpine +COPY default.conf /etc/nginx/conf.d/default.conf +COPY cdn /usr/share/nginx/html diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..b64c703 --- /dev/null +++ b/default.conf @@ -0,0 +1,26 @@ +server { + listen 80; + # listen [::]:80; + server_name localhost; + access_log /usr/share/nginx/access.log; + error_log /usr/share/nginx/error.log; + + location ~ .*\.(gif|jpg|jpeg|png|svg)$ { + root /usr/share/nginx/html; + expires 30d; + } + + location ~ .*\.(js|css|eot|ttf|woff)$ { + root /usr/share/nginx/html; + expires 30d; + gzip on; + gzip_types text/css application/javascript; + } + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + expires 60s; + } +}