Skip to content

Commit

Permalink
feat: add Docker image creation
Browse files Browse the repository at this point in the history
  • Loading branch information
tanguynicolas committed Jun 23, 2024
1 parent ebeb236 commit 3be652e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__pycache__/
.venv
.envrc
.env
docker-compose.yml
README.md
dashboards
33 changes: 33 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Container image build & push

on:
push:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push API image
uses: docker/build-push-action@v3
with:
file: ./Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/ctf-manager:latest
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.11-slim-bookworm
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY ./src /code/app
COPY ./alembic /code/alembic
COPY ./alembic.ini /code/alembic.ini
EXPOSE 80
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]

0 comments on commit 3be652e

Please sign in to comment.