generated from MacarielAerial/gaia
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 007316d
Showing
23 changed files
with
2,641 additions
and
0 deletions.
There are no files selected for viewing
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,76 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose | ||
{ | ||
// Replace placeholder service name | ||
"name": "gaia-dev", | ||
// To launch multiple services, use docker-compose.yml rather than to use a single image | ||
// "image": "abc-dev:latest", | ||
|
||
// Update the 'dockerComposeFile' list if you have more compose files or use different names. | ||
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. | ||
"dockerComposeFile": [ | ||
"../docker-compose.yml", | ||
"docker-compose.yml" | ||
], | ||
|
||
// The 'service' property is the name of the service for the container that VS Code should | ||
// use. Update this value and .devcontainer/docker-compose.yml to the real service name. | ||
// Replace placeholder service name | ||
"service": "gaia", | ||
// "{localWorkspaceFolderBasename}", | ||
|
||
// Mount ssh directory into the container instance | ||
"mounts": [ | ||
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,readonly,type=bind" | ||
], | ||
|
||
// The optional 'workspaceFolder' property is the path VS Code should open by default when | ||
// connected. This is typically a file mount in .devcontainer/docker-compose.yml | ||
// "workspaceMount" is a docker image specific configuration option | ||
// Uncomment the following line when source code is not mounted in a docker-compose.yml | ||
// "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind,consistency=cached", | ||
// "workspaces" folder is almost a mandatory parent folder because of various default paths | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Uncomment the next line if you want start specific services in your Docker Compose config. | ||
// "runServices": [], | ||
|
||
// Uncomment the next line if you want to keep your containers running after VS Code shuts down. | ||
// "shutdownAction": "none", | ||
|
||
// Uncomment the next line to run commands after the container is created. | ||
// "postCreateCommand": "cat /etc/os-release", | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"python.defaultInterpreterPath": "/workspaces/${localWorkspaceFolderBasename}/.venv/bin/python3.10", | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"remote.ssh.enableAgentForwarding": true | ||
}, | ||
"extensions": [ | ||
"vscodevim.vim", | ||
"ms-python.python", | ||
"charliermarsh.ruff", | ||
"ms-toolsai.jupyter", | ||
"mechatroner.rainbow-csv", | ||
"tamasfe.even-better-toml", | ||
"davidanson.vscode-markdownlint", | ||
"ms-azuretools.vscode-docker" | ||
] | ||
} | ||
}, | ||
|
||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "devcontainer" | ||
|
||
// The following command is mandatory because source code mounted volume is owned by vscode | ||
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}" | ||
} |
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,9 @@ | ||
version: '3.8' | ||
services: | ||
gaia: | ||
# Prevent the container from exiting after initialisation | ||
command: /bin/sh -c "while sleep 1000; do :; done" | ||
|
||
volumes: | ||
# Replace placeholder service name | ||
- .:/workspaces/gaia:cached |
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,13 @@ | ||
[flake8] | ||
extend-ignore = | ||
E203 | ||
# E501 line length rule is ignored to delegate the task to black | ||
E501 | ||
exclude = | ||
.git, | ||
__pycache__, | ||
build, | ||
dist, | ||
.venv, | ||
max-complexity = 11 | ||
max-line-length = 88 |
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 @@ | ||
tests/data/** filter=lfs diff=lfs merge=lfs -text |
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,22 @@ | ||
name: ci_general | ||
|
||
on: # yamllint disable-line rule:truthy | ||
push: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and test with devcontainer | ||
uses: devcontainers/[email protected] | ||
with: | ||
runCmd: | | ||
poetry install | ||
poetry run ./lint.sh | ||
poetry run ./test.sh |
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,155 @@ | ||
# From https://github.com/github/gitignore/blob/main/Python.gitignore | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
test_report.xml | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
#.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ |
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,11 @@ | ||
extends: default | ||
|
||
ignore: | | ||
.venv | ||
rules: | ||
comments-indentation: disable | ||
document-start: disable | ||
line-length: | ||
allow-non-breakable-inline-mappings: true | ||
allow-non-breakable-words: true | ||
max: 80 |
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,59 @@ | ||
# | ||
# Multi Stage: Dev Image | ||
# | ||
FROM python:3.11-slim-bookworm AS dev | ||
|
||
# Set environemntal variables | ||
ENV PATH = "${PATH}:/home/poetry/bin" | ||
ENV POETRY_VIRTUALENVS_IN_PROJECT=1 | ||
|
||
# Install graphviz, git and git lfs | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
graphviz \ | ||
graphviz-dev \ | ||
git \ | ||
git-lfs | ||
|
||
# Install poetry | ||
RUN mkdir -p /home/poetry && \ | ||
curl -sSL https://install.python-poetry.org | POETRY_HOME=/home/poetry python3 - && \ | ||
poetry self add poetry-plugin-up | ||
|
||
# | ||
# Multi Stage: Bake Image | ||
# | ||
|
||
FROM dev AS bake | ||
|
||
# Make working directory | ||
RUN mkdir -p /app | ||
|
||
# Only copy necessary files when implemented | ||
COPY . /app | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install python dependencies in container | ||
RUN poetry install --without dev,vis | ||
|
||
# | ||
# Multi Stage: Runtime Image | ||
# | ||
|
||
# Local python is preferred but this image | ||
# has complete system dependencies | ||
FROM python:3.11-slim-bookworm AS runtime | ||
|
||
# Copy over baked environment | ||
COPY --from=bake /app /app | ||
|
||
# Set | ||
WORKDIR /app | ||
|
||
# Set executables in PATH | ||
ENV PATH="/app/.venv/bin:$PATH" | ||
|
||
# TODO: Add a command to start a FastAPI service | ||
# ENTRYPOINT |
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,15 @@ | ||
# Gaia | ||
|
||
# Summary | ||
Gaia is a template repository for python applications | ||
|
||
# Current Feature Set | ||
|
||
1. Isolated and deterministic development system environment with **VS Code Dev Container** | ||
2. Isolated and determinisitc python environment with **Poetry** | ||
3. Isolated and deterministic production system and python environment with **Docker** | ||
4. Static code analysis with tools such as **black** and **coverage** and python code testing with **pytest** | ||
5. GitHub Action workflow for CI purpose (i.e. Build, Test and Release) | ||
|
||
# Future Features | ||
1. Workflow definition to package only python code and to upload to PyPI index |
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,16 @@ | ||
version: '3.8' | ||
|
||
services: | ||
# Replace placeholder service name | ||
gaia: | ||
build: | ||
context: . | ||
# docker-compose file is only used in dev | ||
target: dev | ||
dockerfile: Dockerfile | ||
# Replace placeholder service name | ||
image: gaia-dev | ||
# Replace placeholder service name | ||
container_name: gaia-server | ||
ports: | ||
- '5000:8080' |
Oops, something went wrong.