-
-
Notifications
You must be signed in to change notification settings - Fork 800
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
10 changed files
with
570 additions
and
75 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,73 @@ | ||
venv | ||
__pycache__ | ||
.tox | ||
.github | ||
.vscode | ||
.django_oauth_toolkit.egg-info | ||
.coverage | ||
coverage.xml | ||
|
||
# every time we change this we need to do the COPY . /code and | ||
# RUN pip install -r requirements.txt again | ||
# so don't include the Dockerfile in the context. | ||
Dockerfile | ||
docker-compose.yml | ||
|
||
|
||
# from .gitignore | ||
*.py[cod] | ||
|
||
*.swp | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist | ||
build | ||
eggs | ||
parts | ||
bin | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
lib | ||
lib64 | ||
__pycache__ | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.cache | ||
.pytest_cache | ||
.coverage | ||
.tox | ||
.pytest_cache/ | ||
nosetests.xml | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# PyCharm stuff | ||
.idea | ||
|
||
# Sphinx build dir | ||
_build | ||
|
||
# Sqlite database files | ||
*.sqlite | ||
|
||
/venv/ | ||
/coverage.xml | ||
|
||
db.sqlite3 | ||
venv/ |
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 |
---|---|---|
|
@@ -54,3 +54,5 @@ _build | |
|
||
db.sqlite3 | ||
venv/ | ||
|
||
/tests/app/idp/static |
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,67 @@ | ||
# syntax=docker/dockerfile:1.6.0 | ||
# this Dockerfile is located at the root so the build context | ||
# includes oauth2_provider which is a requirement of the | ||
# tests/app/idp. This way we build images with the source | ||
# code from the repos for validation before publishing packages. | ||
|
||
FROM python:3.11.6-slim as builder | ||
|
||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
ENV DEBUG=False | ||
ENV ALLOWED_HOSTS="*" | ||
ENV TEMPLATES_DIRS="/data/templates" | ||
ENV STATIC_ROOT="/data/static" | ||
ENV DATABASE_URL="sqlite:////data/db.sqlite3" | ||
|
||
RUN apt-get update | ||
# Build Deps | ||
RUN apt-get install -y --no-install-recommends gcc libc-dev python3-dev git openssh-client libpq-dev file libev-dev | ||
# bundle code in a virtual env to make copying to the final image without all the upstream stuff easier. | ||
RUN python -m venv /opt/venv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
# need to update pip and setuptools for pep517 support required by gevent. | ||
RUN pip install --upgrade pip | ||
RUN pip install --upgrade setuptools | ||
COPY . /code | ||
WORKDIR /code/tests/app/idp | ||
RUN pip install -r requirements.txt | ||
RUN pip install gunicorn | ||
RUN python manage.py collectstatic --noinput | ||
|
||
|
||
|
||
FROM python:3.11.6-slim | ||
|
||
# allow embed sha1 at build time as release. | ||
ARG GIT_SHA1 | ||
|
||
LABEL org.opencontainers.image.authors="https://jazzband.co/projects/django-oauth-toolkit" | ||
LABEL org.opencontainers.image.source="https://github.com/jazzband/django-oauth-toolkit" | ||
LABEL org.opencontainers.image.revision=${GIT_SHA1} | ||
|
||
|
||
ENV SENTRY_RELEASE=${GIT_SHA1} | ||
|
||
# disable debug mode, but allow all hosts by default when running in docker | ||
ENV DEBUG=False | ||
ENV ALLOWED_HOSTS="*" | ||
ENV TEMPLATES_DIRS="/data/templates" | ||
ENV STATIC_ROOT="/data/static" | ||
ENV DATABASE_URL="sqlite:////data/db.sqlite3" | ||
|
||
|
||
|
||
|
||
COPY --from=builder /opt/venv /opt/venv | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
COPY --from=builder /code /code | ||
RUN mkdir -p /code/tests/app/idp/static /code/tests/app/idp/templates | ||
WORKDIR /code/tests/app/idp | ||
RUN apt-get update && apt-get install -y \ | ||
libpq5 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
EXPOSE 80 | ||
VOLUME ["/data" ] | ||
CMD ["gunicorn", "idp.wsgi:application", "-w 4 -b 0.0.0.0:80 --chdir=/code --worker-tmp-dir /dev/shm --timeout 120 --error-logfile '-' --log-level debug --access-logfile '-'"] |
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,40 @@ | ||
volumes: | ||
idp-data: | ||
|
||
|
||
x-idp: &idp | ||
image: django-oauth-toolkit/idp | ||
volumes: | ||
- idp-data:/data | ||
|
||
services: | ||
idp-migrate: | ||
<<: *idp | ||
build: . | ||
command: python manage.py migrate | ||
|
||
idp-loaddata: | ||
<<: *idp | ||
command: python manage.py loaddata fixtures/seed.json | ||
depends_on: | ||
idp-migrate: | ||
condition: service_completed_successfully | ||
|
||
idp: | ||
<<: *idp | ||
command: gunicorn idp.wsgi:application -w 4 -b 0.0.0.0:80 --chdir=/code --timeout 120 --error-logfile '-' --log-level debug --access-logfile '-' | ||
ports: | ||
# map to dev port. | ||
- "8000:80" | ||
depends_on: | ||
idp-loaddata: | ||
condition: service_completed_successfully | ||
|
||
rp: | ||
image: django-oauth-toolkit/rp | ||
build: ./tests/app/rp | ||
ports: | ||
# map to dev port. | ||
- "5173:3000" | ||
depends_on: | ||
- idp |
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.