From 7b0c2da223fa8d9ec0847e9779cdd118b1760248 Mon Sep 17 00:00:00 2001 From: Iamjava Date: Sat, 19 Oct 2024 16:33:03 +0200 Subject: [PATCH] better build --- .github/workflows/build.yml | 37 +++++++++++++++++++++++++++++++++++++ .gitignore | 2 +- README.md | 1 - app.py | 4 ++-- 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6e7b34f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,37 @@ +name: Build and Publish Docker Image + +on: + workflow_dispatch: + inputs: + image_name: + description: 'Jans Rezepte' + required: true + default: 'rezepte' + push: + branches: [ "development" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Build and tag Docker image + run: | + docker build -t ${{ github.event.inputs.image_name }}:latest . + docker tag ${{ github.event.inputs.image_name }}:latest ${{ secrets.DOCKER_HUB_USERNAME }}/${{ github.event.inputs.image_name }}:latest + + - name: Push Docker image to Docker Hub + run: | + docker push ${{ secrets.DOCKER_HUB_USERNAME }}/${{ github.event.inputs.image_name }}:latest diff --git a/.gitignore b/.gitignore index 42d794d..bb38aa1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ __pycache__ -data.json +data/data.json data.db data_a.db data.txt diff --git a/README.md b/README.md index ff1ae79..3b71878 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,3 @@ Bäckerone was created while cycling with my friends with the idea to take the c 4. start server (poetry run python -m flask run) ``` - diff --git a/app.py b/app.py index a7216c5..ffd0de2 100644 --- a/app.py +++ b/app.py @@ -5,8 +5,8 @@ app.secret_key = os.urandom(64) app.config['MAX_CONTENT_LENGTH'] = 2 * 1024 * 1024 -DB_DRIVER = "SQLITE" # JSON or SQLITE -DATAFILE = "data.db" +DB_DRIVER = "JSON" # JSON or SQLITE +DATAFILE = "data/data.json" PASSPHRASE = os.environ.get("RECIPE_PASSPHRASE") or "ichessegernekuchen" header = """