Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy to Azure Container Apps

# Manual and monthly rather than on every push: the deployment is a demonstration, and a
# monthly run shows within weeks when the cloud side has rotted.
on:
workflow_dispatch:
schedule:
- cron: '0 6 1 * *'

permissions:
contents: read
packages: write
id-token: write

env:
IMAGE: ghcr.io/winterframework/winter-getting-started
RESOURCE_GROUP: winter-getting-started
CONTAINER_APP: winter-getting-started

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: azure
url: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/checkout@v7

- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
run: |
docker build --tag "$IMAGE:$GITHUB_SHA" .
docker push "$IMAGE:$GITHUB_SHA"

- uses: azure/login@v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Deploy
id: deploy
run: |
az containerapp update --name "$CONTAINER_APP" --resource-group "$RESOURCE_GROUP" \
--image "$IMAGE:$GITHUB_SHA" --output none
fqdn=$(az containerapp show --name "$CONTAINER_APP" --resource-group "$RESOURCE_GROUP" \
--query properties.configuration.ingress.fqdn --output tsv)
echo "url=https://$fqdn" >> "$GITHUB_OUTPUT"

- name: Check that the app answers
# Scaled to zero, the app needs time to start
run: curl --fail --retry 15 --retry-all-errors --retry-delay 10 "${{ steps.deploy.outputs.url }}/greeting/"
17 changes: 17 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: docker
on: push

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Build image
run: docker build --tag winter-getting-started .
- name: Start container
run: docker run --detach --name app --publish 8080:8080 winter-getting-started
- name: Check that the app answers
run: curl --fail --retry 10 --retry-all-errors --retry-delay 2 http://localhost:8080/greeting/
- name: Container logs
if: failure()
run: docker logs app
74 changes: 0 additions & 74 deletions .github/workflows/gke.yml

This file was deleted.

14 changes: 8 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
uses: abatilo/actions-poetry@v2
uses: abatilo/actions-poetry@v4
with:
poetry-version: "1.5.1"
poetry-version: "2.5.1"
- name: Install dependencies
run: poetry install
- name: Check Django configuration
run: poetry run python manage.py check
- name: Run Tests
run: poetry run pytest .
run: poetry run pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ static

# pyenv
.python-version
.venv
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM python:3.10-alpine3.20
FROM python:3.13-slim

RUN apk add --no-cache build-base libffi-dev musl-dev postgresql-dev
LABEL org.opencontainers.image.source=https://github.com/WinterFramework/winter-getting-started

ENV PYTHONUNBUFFERED=1 POETRY_VERSION=1.8.3
RUN pip install "poetry==$POETRY_VERSION"
ENV PYTHONUNBUFFERED=1 POETRY_VERSION=2.5.1
RUN pip install --no-cache-dir "poetry==$POETRY_VERSION"

WORKDIR /app
COPY poetry.lock pyproject.toml /app/

RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
&& poetry install --only main --no-interaction --no-ansi

COPY . /app

CMD gunicorn --bind :8080 simple_api.wsgi
CMD ["gunicorn", "--bind", ":8080", "simple_api.wsgi"]
Loading
Loading