Skip to content

Commit

Permalink
modernise
Browse files Browse the repository at this point in the history
  • Loading branch information
classabbyamp committed Oct 8, 2024
1 parent ea34532 commit e83e443
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 17 deletions.
74 changes: 62 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,68 @@
name: CI
# vim: ts=2 sw=2:

on: [push]
name: Docker Build and Deploy

jobs:
build-and-publish-latest:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' # Running this job only for master branch
on:
workflow_dispatch:
pull_request:
branches:
- master
push:
# Publish `master` as Docker `dev` image.
branches:
- master
# Publish `v*` tags as x.x.x images and as `latest`.
tags:
- v*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
docker:
name: Build and push docker images
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v2 # Checking out the repo
- name: Checkout
uses: classabbyamp/treeless-checkout-action@v1

- name: Write ref to file
if: ${{ github.event_name != 'pull_request' }}
run: git rev-list -n 1 $GITHUB_REF > ./git_commit

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=sha,prefix=
type=raw,value=dev,enable={{is_default_branch}}
type=match,pattern=v(.*),group=1
labels: |
org.opencontainers.image.authors=classabbyamp
org.opencontainers.image.url=https://github.com/classabbyamp/qsl-generator
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.vendor=classabbyamp
org.opencontainers.image.title=qsl-generator
org.opencontainers.image.description=flask webapp to generate QSL card designs
org.opencontainers.image.licenses=MIT
- name: Build and Publish latest Docker image
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: qsl-generator # Provide only Docker image name, tag will be automatically set to latest
- name: Login to Github Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM python:3.8

ENV PYTHONDONTWRITEBYTECODE 1
ENV FLASK_APP "app.py"
ENV FLASK_ENV "production"
ENV FLASK_DEBUG False
ENV PYTHONDONTWRITEBYTECODE=1
ENV FLASK_APP="app.py"
ENV FLASK_ENV="production"
ENV FLASK_DEBUG=False

RUN mkdir /app
WORKDIR /app
Expand All @@ -15,4 +15,4 @@ RUN pip install -U pip && \

EXPOSE 5000

CMD flask run --host=0.0.0.0
CMD ["flask", "run", "--host=0.0.0.0"]

0 comments on commit e83e443

Please sign in to comment.