diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..79e0dbf --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,52 @@ +name: release-tag + +on: + push + +jobs: + release-image: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + env: + DOCKER_ORG: angoosh + DOCKER_LATEST: latest + RUNNER_TOOL_CACHE: /toolcache + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker BuildX + uses: docker/setup-buildx-action@v2 + with: + config-inline: | + [registry."gitea.angoosh.com"] + #http = true + #insecure = true + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + registry: https://gitea.angoosh.com + username: ${{ secrets.PKG_REG_USER }} + password: ${{ secrets.PKG_REG_PASS }} + + - name: Get Meta + id: meta + run: | + echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT + echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + platforms: | + linux/amd64 + push: true + tags: | + gitea.angoosh.com/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ada9514 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3-alpine +ADD requirements.txt / +RUN pip install -r requirements.txt +ADD app.py / +RUN mkdir /db +VOLUME /db +EXPOSE 5000 +CMD [ "python", "./app.py" ] + diff --git a/app.py b/app.py index 827a654..1018cf9 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,7 @@ from flask import Flask, render_template_string, redirect, url_for import sqlite3 app = Flask(__name__) -DB_FILE = 'counter.db' +DB_FILE = '/db/counter.db' def init_db(): """Initialize the database and set the starting number to 0 if it doesn't exist.""" @@ -98,4 +98,4 @@ if __name__ == '__main__': # Initialize the database before starting the server init_db() # Run the app in debug mode - app.run(debug=True) \ No newline at end of file + app.run(debug=True) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7e10602 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +flask