From 002cf1ad078b0b2a30e2d9d7b28d59ee640fb57a Mon Sep 17 00:00:00 2001 From: Sweetbread Date: Sun, 28 Dec 2025 00:07:17 +0300 Subject: [PATCH] ci: add docker image creation --- .gitea/workflows/docker-build.yml | 31 +++++++++++++++++++++++++++++++ .gitignore | 1 - Dockerfile | 23 +++++++++++++++++++++++ requirements.txt | 1 + 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100755 .gitea/workflows/docker-build.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml new file mode 100755 index 0000000..68340b4 --- /dev/null +++ b/.gitea/workflows/docker-build.yml @@ -0,0 +1,31 @@ +name: Docker Build and Push + +on: + push: + branches: [main] + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to Docker Registry + uses: docker/login-action@v2 + with: + registry: git.kolibrios.org + username: kolibrios + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name == 'push' }} + tags: git.kolibrios.org/kolibrios/kolibrios.org:latest + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.gitignore b/.gitignore index c0386f4..b209975 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,6 @@ htmlcov/ docs/_build/ # Our's -Dockerfile .env static/*.css static/*.css.map diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bc6852f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM node:18-alpine as sass + +RUN npm install -g sass +WORKDIR /build +COPY ./static ./static +RUN sass ./static:./static \ + --no-source-map \ + --style=compressed + + +FROM python:3.11-slim + +WORKDIR /app + +COPY . . +COPY --from=sass /build/static/ ./static/ + +RUN pip install --no-cache-dir -r requirements.txt + +ENV FLASK_ENV=production +ENV PYTHONUNBUFFERED=1 + +CMD ["gunicorn", "app:app", "-b", "0.0.0.0:80", "--workers", "4"] diff --git a/requirements.txt b/requirements.txt index ff91176..fabbf3c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ Jinja2==3.1.6 libsass==0.23.0 MarkupSafe==3.0.2 Werkzeug==3.1.3 +gunicorn