commit 7dbb1418e9ab65cf5da31946dc6e1dfd8aaf5937 Author: Arnaud Scheffler Date: Thu Oct 3 11:29:39 2024 +0200 Initial commit diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2dc43fd --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.DS_Store +.coverage +/.env +/.idea/ +/.git +/tmp/ +/.venv/ +__pycache__/ diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..58b9e67 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,34 @@ +name: ci + +on: + push: + +env: + IMAGE_NAME: arnaud/my-test-app + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: git.s-algo.com + username: ${{ gitea.repository_owner }} + password: ${{ secrets.GITEA_TOKEN}} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + tags: ${{ steps.meta.outputs.tags }} + annotations: ${{ steps.meta.outputs.annotations }} + push: true \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2dc43fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +.coverage +/.env +/.idea/ +/.git +/tmp/ +/.venv/ +__pycache__/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a7a30da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.12 + +WORKDIR /app + +COPY ./requirements.txt . + +RUN pip install --no-cache-dir --quiet -r requirements.txt + +COPY ./my_api ./my_api + +CMD ["fastapi", "run", "my_api/app.py"] \ No newline at end of file diff --git a/my_api/__init__.py b/my_api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/my_api/app.py b/my_api/app.py new file mode 100644 index 0000000..ee60be1 --- /dev/null +++ b/my_api/app.py @@ -0,0 +1,8 @@ +from fastapi import FastAPI + +app = FastAPI() + + +@app.get("/") +async def root(): + return {"message": "Hello World"} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..be08dc6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +fastapi[standard] \ No newline at end of file