From 6b2b8395ce37b1fdea085dd3f0471f2a3ac9bdff Mon Sep 17 00:00:00 2001 From: yehor Date: Tue, 20 May 2025 09:42:07 +0300 Subject: [PATCH] Add docker file and an action --- .gitea/workflows/release.yaml | 47 ++++++++++++++++++++++++++++++++ Dockerfile | 7 +++++ nginx.conf | 50 +++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 .gitea/workflows/release.yaml create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..ea59051 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,47 @@ +name: Build release image + +on: + push: + tags: + - "*.*.*" + +jobs: + build: + runs-on: ubuntu-22.04 + container: + image: git.nicelycomposed.codes/koshyk-io/flutter-gitea-action-image-builder:latest + credentials: + username: ${{ secrets.IMAGE_REGISTRY_USER }} + password: ${{ secrets.IMAGE_REGISTRY_PASSWORD }} + steps: + - name: Checkout source code + uses: actions/checkout@v4 + - name: Set up NodeJS + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Get dependencies + working-directory: ${{ gitea.workspace }} + run: | + npm install --global yarn + yarn + - name: Build website + working-directory: ${{ gitea.workspace }} + run: | + yarn build + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Registry + uses: docker/login-action@v3 + with: + registry: git.nicelycomposed.codes + username: ${{ secrets.IMAGE_REGISTRY_USER }} + password: ${{ secrets.IMAGE_REGISTRY_PASSWORD }} + - name: Build docker image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + git.nicelycomposed.codes/yehor/www-yevi-org:${{ gitea.ref_name }} + git.nicelycomposed.codes/yehor/www-yevi-org:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9ce4135 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM nginx:1.27.0 + +COPY ./build /usr/share/nginx/html + +COPY ./nginx.conf /etc/nginx/nginx.conf + +EXPOSE 80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..75d9720 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,50 @@ +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + server { + listen 80; + listen [::]:80; + server_name localhost; + + gzip on; + gzip_types text/html application/javascript application/json text/css; + + # where the root here + root /usr/share/nginx/html; + # what file to server as index + index index.html; + + error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + #error_page 500 502 503 504 /50x.html; + #location = /50x.html { + # root /usr/share/nginx/html; + #} + } +} \ No newline at end of file