-
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
Showing
17 changed files
with
430 additions
and
242 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,44 @@ | ||
# App specific | ||
certificates | ||
*.sqlite3 | ||
docker_initial_setup.sh | ||
|
||
# Common | ||
README.md | ||
|
||
# Docker | ||
docker-compose.yml | ||
Dockerfile | ||
.docker | ||
.dockerignore | ||
container.env | ||
|
||
# git | ||
.git | ||
.gitattributes | ||
.gitignore | ||
# GitHub | ||
.github | ||
|
||
## Python | ||
# Byte-compiled | ||
**/__pycache__/ | ||
**/*.py[cod] | ||
|
||
# Virtual environment | ||
.env | ||
.venv/ | ||
venv/ | ||
|
||
## Editors | ||
# Vim swap files | ||
**/*.swp | ||
|
||
# VS Code | ||
.vscode/ | ||
|
||
# JetBrains | ||
.idea | ||
|
||
# Notepad++ | ||
.editorconfig |
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,17 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 4 | ||
max_line_length = 80 | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.py] | ||
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,46 @@ | ||
name: Build and Push Docker Images | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
env: | ||
IMAGE_NAME: humitifier | ||
DOCKERFILE_PATH: ./Dockerfile | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push main image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ${{ env.DOCKERFILE_PATH }} | ||
push: true | ||
tags: | | ||
ghcr.io/centrefordigitalhumanities/development-idp/${{ env.IMAGE_NAME }}:${{ github.ref_name }} | ||
- name: Grype Scan | ||
id: scan | ||
uses: anchore/scan-action@v3 | ||
with: | ||
image: ghcr.io/centrefordigitalhumanities/humitifier/${{ env.IMAGE_NAME }}:${{ github.ref_name }} | ||
fail-build: false | ||
|
||
- name: upload Grype SARIF report | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: ${{ steps.scan.outputs.sarif }} |
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,26 @@ | ||
FROM python:3.11-alpine3.20 | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
# Copy app | ||
WORKDIR /app | ||
COPY . /app | ||
|
||
# Install dependencies | ||
RUN apk add git xmlsec gettext | ||
RUN pip install -r requirements.txt | ||
RUN pip install gunicorn | ||
|
||
# Cleanup | ||
RUN apk del git | ||
|
||
# Compile messages | ||
RUN python manage.py compilemessages | ||
|
||
# Collect static files | ||
## Create public dir to store them in | ||
RUN mkdir -p /app/public/static | ||
## Collect them | ||
RUN python manage.py collectstatic --noinput | ||
|
||
EXPOSE 7000 | ||
CMD ["sh", "docker/run.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
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,12 @@ | ||
DJANGO_SECRET_KEY="django-insecure-lb=q@u4df-x0th(5u%$eye_ti#etst+5z+%2=lrh$$le3&v_y$" | ||
DJANGO_DEBUG="True" | ||
DJANGO_DEBUG_TOOLBAR="True" | ||
DJANGO_HOST="localhost:7000" | ||
DJANGO_ALLOWED_HOSTS="localhost,127.0.0.1" | ||
DJANGO_DB_TYPE="sqlite3" | ||
DJANGO_SQLLITE_FILE="/run/db/db.sqlite3" | ||
DJANGO_HTTPS="False" | ||
|
||
DJANGO_IDP_PRIVATE_KEY="/run/secrets/private_key" | ||
DJANGO_IDP_PUBLIC_CERT="/run/secrets/public_cert" | ||
# TODO: document all variables _somewhere_ |
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,28 @@ | ||
services: | ||
dev-idp: | ||
build: . | ||
ports: | ||
- 7000:7000 | ||
env_file: | ||
- ./container.env | ||
volumes: | ||
- ./db:/run/db | ||
networks: | ||
- default | ||
# Below allows for debugging with pdb etc. | ||
stdin_open: true | ||
tty: true | ||
secrets: | ||
- private_key | ||
- public_cert | ||
|
||
|
||
networks: | ||
default: | ||
|
||
secrets: | ||
private_key: | ||
file: ./certificates/private.key | ||
public_cert: | ||
file: ./certificates/public.cert | ||
|
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,7 @@ | ||
#!/bin/sh | ||
|
||
# Migrate the database | ||
python manage.py migrate | ||
|
||
# Run da server | ||
exec gunicorn testidp.wsgi:application -c gunicorn.conf.py "$@" |
Oops, something went wrong.