Skip to content

Commit 1ffd85e

Browse files
committed
Add initial project structure with Docker, CI/CD, and FastAPI setup
1 parent 845283a commit 1ffd85e

32 files changed

Lines changed: 617 additions & 0 deletions

.devcontainer/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM mcr.microsoft.com/devcontainers/python:dev-3.13-bookworm
2+
3+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
4+
WORKDIR /example
5+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
6+
ENV UV_LINK_MODE=copy
7+
ENV UV_PROJECT_ENVIRONMENT="/usr/local/"
8+
COPY . .
9+
RUN mkdir -p ./.vscode && uv sync --dev --prerelease=allow
10+
CMD ["tail", "-f", "/dev/null"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
{
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"name": "App Debug",
7+
"type": "debugpy",
8+
"request": "launch",
9+
"program": "app.py",
10+
"console": "integratedTerminal"
11+
}
12+
]
13+
}

.devcontainer/devcontainer.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "Example",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"dockerComposeFile": "./docker-compose.yaml",
7+
"service": "example",
8+
"workspaceFolder": "/example",
9+
"shutdownAction": "stopCompose",
10+
"forwardPorts": [
11+
8002
12+
],
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"vivaxy.vscode-conventional-commits",
17+
"ms-toolsai.datawrangler",
18+
"mikestead.dotenv",
19+
"elagil.pre-commit-helper",
20+
"donjayamanne.python-extension-pack",
21+
"charliermarsh.ruff",
22+
"sourcery.sourcery", // Remove sourcery and sonarlint if you have less memory
23+
"SonarSource.sonarlint-vscode",
24+
"redhat.vscode-yaml",
25+
"ms-azuretools.vscode-docker",
26+
"ms-toolsai.jupyter"
27+
],
28+
"settings": {
29+
"[python]": {
30+
"editor.formatOnType": false,
31+
"editor.codeActionsOnSave": {
32+
"source.organizeImports.ruff": "explicit",
33+
"source.fixAll": "explicit",
34+
"source.formatDocument": "always"
35+
}
36+
},
37+
"files.watcherExclude": {
38+
"**/.git/objects/**": true,
39+
"**/.git/subtree-cache/**": true,
40+
"**/.hg/store/**": true,
41+
"**/.pytest_cache/**": true,
42+
"**/.ruff_cache/**": true,
43+
"**/__pycache__/**": true,
44+
"./data/**": true,
45+
}
46+
}
47+
}
48+
},
49+
"remoteUser": "root",
50+
"containerUser": "root",
51+
"postCreateCommand": "mkdir .vscode -p && cp /example/.devcontainer/container-launch.json .vscode/launch.json && pre-commit install -t pre-commit && pre-commit install-hooks",
52+
"features": {
53+
"ghcr.io/jsburckhardt/devcontainer-features/ruff:1": {},
54+
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {}
55+
}
56+
// Features to add to the dev container. More info: https://containers.dev/features.
57+
// "features": {},
58+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
59+
// "forwardPorts": [],
60+
// Use 'postCreateCommand' to run commands after the container is created.
61+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
62+
// Configure tool-specific properties.
63+
// "customizations": {},
64+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
65+
// "remoteUser": "root"
66+
}

.devcontainer/docker-compose.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: example-dev
2+
services:
3+
example:
4+
build:
5+
context: ..
6+
dockerfile: .devcontainer/Dockerfile
7+
ports:
8+
- "8002:8002"
9+
environment:
10+
- MODULE_NAME=example
11+
- BASE_PATH=/data
12+
- PYTHONDONTWRITEBYTECODE=1
13+
volumes:
14+
- ..:/example
15+
- ../data:/data

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: weekly

.github/workflows/deploy.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy App Engine
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Setup new version on Server
14+
uses: appleboy/ssh-action@master
15+
with:
16+
host: ${{ secrets.PRODUCTION_SERVER_HOST }}
17+
username: ${{ secrets.PRODUCTION_SERVER_USERNAME }}
18+
key: ${{ secrets.PRODUCTION_SERVER_SSH_KEY }}
19+
script: |
20+
/home/exior/code/deploy_scripts/build_deploy_app_engine

.github/workflows/linter.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Linter
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
lint-test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Lint
12+
uses: astral-sh/ruff-action@v2
13+
- name: Check Format
14+
uses: astral-sh/ruff-action@v2
15+
with:
16+
args: "format --check"

.github/workflows/tests.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Tester
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Install uv
12+
uses: astral-sh/setup-uv@v4
13+
- name: "Set up Python"
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version-file: ".python-version"
17+
- name: Install the project
18+
run: uv sync --all-extras --dev
19+
- name: Run tests
20+
run: uv run pytest --cov

0 commit comments

Comments
 (0)