diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..78d922b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: ci + +on: push + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Read image identifiers + id: image + uses: ASzc/change-string-case-action@v1 + with: + string: ${{ github.repository }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + tags: | + ghcr.io/${{ steps.image.outputs.lowercase }}:latest + ghcr.io/${{ steps.image.outputs.lowercase }}:${{ github.sha }} + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d02bc75 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.10.9-slim-bullseye as base +LABEL maintainer="nvo87@fands.dev" + +ENV PYTHONUNBUFFERED 1 + +WORKDIR /code + +COPY ./requirements.txt /code/requirements.txt + +RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt + +COPY ./src /code/src + +CMD ["uvicorn", "src.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"]