-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
1,056 additions
and
1,229 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
name: Deploy to AWS | ||
environment: deploy-to-aws | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: ${{ vars.AWS_REGION }} | ||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ vars.AWS_DEPLOYMENT_ROLE }} | ||
- uses: aws-actions/amazon-ecr-login@v2 | ||
id: log-into-ecr | ||
- name: Build, tag, and push Docker image to Amazon ECR | ||
id: build-tag-and-push-docker-image | ||
env: | ||
TAG: ${{ steps.log-into-ecr.outputs.registry }}/atoti-project-template:${{ github.sha }} | ||
run: | | ||
docker build --tag $TAG . | ||
docker push $TAG | ||
echo "tag=$TAG" >> $GITHUB_OUTPUT | ||
- name: Inline variables in the task definition | ||
run: sed -i -e 's/AWS_ACCOUNT_ID/${{ secrets.AWS_ACCOUNT_ID }}/g' -e 's/AWS_DATABASE_URL_SECRET_NAME/${{ vars.AWS_DATABASE_URL_SECRET_NAME }}/g' -e 's/AWS_EXECUTION_ROLE/${{ vars.AWS_EXECUTION_ROLE }}/g' -e 's/AWS_REGION/${{ vars.AWS_REGION }}/g' task-definition.json | ||
- uses: aws-actions/amazon-ecs-render-task-definition@v1 | ||
id: render-task-definition | ||
with: | ||
container-name: atoti-session | ||
image: ${{ steps.build-tag-and-push-docker-image.outputs.tag }} | ||
task-definition: task-definition.json | ||
- uses: aws-actions/amazon-ecs-deploy-task-definition@v2 | ||
with: | ||
cluster: atoti-project-template | ||
service: atoti-project-template | ||
task-definition: ${{ steps.render-task-definition.outputs.task-definition }} | ||
wait-for-service-stability: true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
__pycache__/ | ||
.venv/ | ||
content/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
# syntax=docker/dockerfile:1.2 | ||
# Inspired from https://github.com/astral-sh/uv-docker-example/blob/dee88a8c43be3b16b0ad58f0daee5eaee7e2157a/multistage.Dockerfile. | ||
|
||
# `--platform=linux/am64` is required to build this image on macOS with Apple Silicon until https://github.com/activeviam/jdk4py/issues/73 is done. | ||
FROM --platform=linux/amd64 python:3.9.18-slim AS builder | ||
FROM ghcr.io/astral-sh/uv:0.4.10-python3.10-bookworm-slim AS builder | ||
|
||
RUN pip install poetry==1.7.1 | ||
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy | ||
|
||
COPY poetry.lock pyproject.toml ./ | ||
WORKDIR /venv | ||
|
||
RUN POETRY_VIRTUALENVS_CREATE=false poetry install --no-cache --no-root --only main --sync | ||
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-dev --no-install-project | ||
|
||
FROM --platform=linux/amd64 python:3.9.18-slim AS runner | ||
# Keep this synced with the builder image. | ||
FROM python:3.10-slim-bookworm | ||
|
||
ENV ATOTI_HIDE_EULA_MESSAGE=true | ||
ENV PORT=80 | ||
COPY --from=builder /venv app | ||
|
||
ENV PATH="/app/.venv/bin:$PATH" | ||
|
||
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages | ||
COPY app app | ||
|
||
ENTRYPOINT ["python", "-u", "-m", "app"] | ||
ENV ATOTI_HIDE_EULA_MESSAGE=true | ||
ENV PORT=80 | ||
|
||
EXPOSE $PORT | ||
|
||
CMD ["python", "-u", "-m", "app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import annotations | ||
|
||
from .config import * | ||
from .constants import * | ||
from .start_app import * | ||
from .config import Config as Config | ||
from .constants import * # noqa: F403 | ||
from .start_app import start_app as start_app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from __future__ import annotations | ||
from urllib.parse import urlparse | ||
|
||
from . import Config, start_app | ||
|
||
with start_app(config=Config()) as session: | ||
print(f"Session listening on port {session.port}") # noqa: T201 | ||
port = urlparse(session.url) or 80 | ||
print(f"Session listening on port {port}") # noqa: T201 | ||
session.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import annotations | ||
|
||
from enum import Enum | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.