-
Notifications
You must be signed in to change notification settings - Fork 2
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
22 changed files
with
1,168 additions
and
425 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Docker | ||
Dockerfile | ||
.dockerignore | ||
.venv | ||
|
||
# git | ||
.circleci | ||
|
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,81 @@ | ||
name: Build and Deploy | ||
on: push | ||
jobs: | ||
django-check: | ||
name: Django Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: v0-${{ hashFiles('./uv.lock') }} | ||
- name: Install Dependencies | ||
run: |- | ||
cd . | ||
uv sync --frozen | ||
- name: Test (run in parallel) | ||
run: |- | ||
cd . | ||
uv run coverage run --concurrency=multiprocessing manage.py test --settings=penncfa.settings.ci --parallel | ||
uv run coverage combine | ||
- name: Upload Code Coverage | ||
run: |- | ||
ROOT=$(pwd) | ||
cd . | ||
uv run codecov --root $ROOT --flags backend | ||
container: | ||
image: ghcr.io/astral-sh/uv:0.6.2-python3.12-bookworm | ||
env: | ||
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres | ||
services: | ||
postgres: | ||
image: postgres:17 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: postgres | ||
POSTGRES_PASSWORD: postgres | ||
options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5" | ||
publish-backend: | ||
name: Publish backend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-qemu-action@v1 | ||
- uses: docker/setup-buildx-action@v1 | ||
- name: Cache Docker layers | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: buildx-publish-backend | ||
- uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build/Publish | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: ${{ github.ref == 'refs/heads/master' }} | ||
cache-from: type=local,src=/tmp/.buildx-cache,type=registry,ref=pennlabs/common-funding-application:latest | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
tags: pennlabs/common-funding-application:latest,pennlabs/common-funding-application:${{ github.sha }} | ||
needs: django-check | ||
|
||
deploy: | ||
name: "Deploy" | ||
uses: pennlabs/shared-actions/.github/workflows/deployment.yaml@v0.1.3-patch.1 | ||
|
||
with: | ||
githubRef: ${{ github.ref }} | ||
gitSha: ${{ github.sha }} | ||
|
||
secrets: | ||
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | ||
GH_AWS_ACCESS_KEY_ID: ${{ secrets.GH_AWS_ACCESS_KEY_ID }} | ||
GH_AWS_SECRET_ACCESS_KEY: ${{ secrets.GH_AWS_SECRET_ACCESS_KEY }} | ||
|
||
needs: | ||
- publish-backend |
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
FROM pennlabs/django-base:3cadd22f7ad51359c5e86b6a3cba2fc155c1c6ab | ||
FROM ghcr.io/astral-sh/uv:0.6.2-python3.12-bookworm | ||
|
||
LABEL maintainer="Penn Labs" | ||
|
||
# Copy project dependencies | ||
COPY Pipfile* /app/ | ||
|
||
# Install project dependencies | ||
RUN pipenv install --system | ||
|
||
# Copy project files | ||
COPY . /app/ | ||
COPY ./scripts/mime.types /etc/mime.types | ||
COPY ./scripts/django-run /usr/local/bin/ | ||
|
||
WORKDIR /app | ||
RUN uv sync --frozen | ||
|
||
ENV DJANGO_SETTINGS_MODULE penncfa.settings.production | ||
ENV SECRET_KEY 'temporary key just to build the docker image' | ||
ENV PATH="/app/.venv/bin:$PATH" | ||
|
||
# Collect static files | ||
RUN python3 /app/manage.py collectstatic --noinput | ||
RUN uv run /app/manage.py collectstatic --noinput | ||
CMD ["/usr/local/bin/django-run"] |
Oops, something went wrong.