Skip to content

Commit

Permalink
chore: add Docker image and publish to DockerHub
Browse files Browse the repository at this point in the history
  • Loading branch information
bfabio committed Jul 22, 2024
1 parent 395f461 commit 9d16b41
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**/.git
**/.gitignore
**/.vscode
**/coverage
**/.env
**/.ssh
Dockerfile
README.md
docker-compose.yml
**/venv
**/env
31 changes: 31 additions & 0 deletions .github/workflows/build_and_publish_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
push:
branches:
- main

jobs:
build_and_publish_docker_image:
runs-on: ubuntu-latest

steps:
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get Docker image tags
id: image_tags
run: |
IMAGE=italia/publiccode-issueopener
TAGS=${IMAGE}:latest
TAGS="$TAGS,${IMAGE}:${GITHUB_SHA::8}"
echo ::set-output name=tags::${TAGS}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.image_tags.outputs.tags }}
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.12-slim as build

WORKDIR /app

RUN addgroup --system app && adduser --system --home /home/app --group app

USER app

COPY requirements.txt .
COPY templates/ templates/
COPY main.py .

RUN pip install -r requirements.txt

CMD ["./main.py", "--help"]

0 comments on commit 9d16b41

Please sign in to comment.