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
15 changes: 5 additions & 10 deletions .github/workflows/_deploy_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@ on:
environment:
required: true
type: string
docker_tag:
required: true
type: string

jobs:
deploy:
runs-on: ubuntu-22.04
environment: ${{ inputs.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install uv
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
with:
version: ${{ vars.UV_VERSION }}

- name: Install Python packages
run: uv sync --locked --no-dev
- name: Print docker tag
run: echo "Docker tag:${{ inputs.docker_tag }}"
shell: bash
19 changes: 19 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
continuous-integration:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
outputs:
api-docker-tag: ${{ steps.api-docker-tag.outputs.api-docker-tag }}
env:
COMMON__ENVIRONMENT: Development
steps:
Expand Down Expand Up @@ -46,11 +48,26 @@ jobs:
run: uv run --frozen -- pytest -m integration
shell: bash

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

- name: Set api docker tag
id: api-docker-tag
run: echo "api-docker-tag=myregistry/api:${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT

- name: Build and push api
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
file: api/src/api/Dockerfile
tags: ${{ steps.api-docker-tag.outputs.api-docker-tag }}
push: false

deploy-api-dev:
needs: continuous-integration
uses: ./.github/workflows/_deploy_api.yaml
with:
environment: dev
docker_tag: ${{ needs.continuous-integration.outputs.api-docker-tag }}
secrets: inherit

deploy-transcriber-dev:
Expand All @@ -65,6 +82,7 @@ jobs:
uses: ./.github/workflows/_deploy_api.yaml
with:
environment: stg
docker_tag: ${{ needs.continuous-integration.outputs.api-docker-tag }}
secrets: inherit

deploy-transcriber-stg:
Expand All @@ -79,6 +97,7 @@ jobs:
uses: ./.github/workflows/_deploy_api.yaml
with:
environment: pro
docker_tag: ${{ needs.continuous-integration.outputs.api-docker-tag }}
secrets: inherit

deploy-transcriber-pro:
Expand Down
2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name = "api"
version = "0.1.0"

[build-system]
requires = ["uv_build>=0.8.0,<0.9.0"]
requires = ["uv_build>=0.8.11,<0.9.0"]
build-backend = "uv_build"
18 changes: 11 additions & 7 deletions api/src/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# 0.7.19-python3.12-bookworm-slim
FROM astral/uv@sha256:235c2e8419851c1d539e2b19033d56aaf82670bfaaa155e20ac6b21260dc0be9 AS builder
# 0.8.11-python3.12-bookworm-slim
FROM astral/uv@sha256:165703e3c12d7fca3dfa15b2012b98d6e03c261a516d4bd7ca3a956c57c7abce AS builder

ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=0

WORKDIR /app
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-workspace --no-dev
COPY pyproject.toml uv.lock ./
COPY api api
COPY common common
COPY domain domain
COPY api api
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev
uv sync --frozen --no-dev

# 3.12.11-slim-bookworm
FROM python@sha256:4600f71648e110b005bf7bca92dbb335e549e6b27f2e83fceee5e11b3e1a4d01 AS final
FROM python@sha256:42cf2422587a3dac0e0a3674a4d86f01570d5d7260588f3845f51e6176d8134b AS final

ENV COMMON__ENVIRONMENT=""

Expand All @@ -20,5 +25,4 @@ COPY --from=builder --chown=nonroot /app /app
WORKDIR /app
EXPOSE 8000
USER nonroot
CMD [".venv/bin/poe", "start-api-pro"]

CMD [".venv/bin/poe", "start-api-pro"]
2 changes: 1 addition & 1 deletion common/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name = "common"
version = "0.1.0"

[build-system]
requires = ["uv_build>=0.8.0,<0.9.0"]
requires = ["uv_build>=0.8.11,<0.9.0"]
build-backend = "uv_build"
2 changes: 1 addition & 1 deletion domain/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name = "domain"
version = "0.1.0"

[build-system]
requires = ["uv_build>=0.8.0,<0.9.0"]
requires = ["uv_build>=0.8.11,<0.9.0"]
build-backend = "uv_build"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dev = [
]

[tool.uv]
required-version = ">=0.8.0,<0.9.0"
required-version = ">=0.8.11,<0.9.0"

[tool.uv.workspace]
members = ["api", "domain", "transcriber", "test_utils", "common", "scripts"]
Expand Down
2 changes: 1 addition & 1 deletion test_utils/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name = "test-utils"
version = "0.1.0"

[build-system]
requires = ["uv_build>=0.8.0,<0.9.0"]
requires = ["uv_build>=0.8.11,<0.9.0"]
build-backend = "uv_build"
2 changes: 1 addition & 1 deletion transcriber/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name = "transcriber"
version = "0.1.0"

[build-system]
requires = ["uv_build>=0.8.0,<0.9.0"]
requires = ["uv_build>=0.8.11,<0.9.0"]
build-backend = "uv_build"
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading