forked from nmaekawa/catchpy
-
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.
Merge pull request nmaekawa#25 from artshumrc/update-dockerfile
Update Python, Django, Dockerfile, tests, CI
- Loading branch information
Showing
12 changed files
with
158 additions
and
39 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,27 @@ | ||
*.pyc | ||
*.pyo | ||
*.mo | ||
*.db | ||
*.css.map | ||
*.egg-info | ||
*.sql.gz | ||
.cache | ||
.project | ||
.idea | ||
.pydevproject | ||
.idea/workspace.xml | ||
.DS_Store | ||
.git/ | ||
.github/ | ||
.tox/ | ||
.sass-cache | ||
.vagrant/ | ||
__pycache__ | ||
dist | ||
docs | ||
env | ||
venv/ | ||
logs | ||
stats | ||
Dockerfile | ||
test.Dockerfile |
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,27 @@ | ||
name: CI - Pytest | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, reopened, edited, synchronize] | ||
|
||
env: | ||
CATCHPY_DOTENV_PATH: docker_dotenv.env | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build Docker images | ||
run: | | ||
docker compose -f docker-compose-test.yml build | ||
- name: Run Docker Compose containers | ||
run: | | ||
docker compose -f docker-compose-test.yml up -d | ||
- name: Run Pytest unit tests within Compose | ||
run: | | ||
docker compose -f docker-compose-test.yml exec web bash -c "tox" | ||
- name: Stop Docker Compose containers | ||
if: always() | ||
run: docker compose -f docker-compose.yml down |
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 |
---|---|---|
|
@@ -48,3 +48,5 @@ catch/settings/local.py | |
|
||
# static root | ||
public/ | ||
|
||
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
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
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,12 +1,12 @@ | ||
Django==3.2.18 | ||
iso8601==1.1.0 | ||
jsonschema==4.17.3 | ||
psycopg2==2.9.5 | ||
PyJWT==2.6.0 | ||
Django~=4.2 | ||
iso8601~=2.0.0 | ||
jsonschema==4.18.4 | ||
psycopg>=3.1.8 | ||
PyJWT==2.8.0 | ||
PyLD==2.0.3 | ||
python-dateutil==2.8.2 | ||
python-dotenv==1.0.0 | ||
pytz==2022.7.1 | ||
requests==2.28.2 | ||
pytz==2023.3 | ||
requests~=2.31.0 | ||
django-log-request-id==2.1.0 | ||
django-cors-headers==3.14.0 | ||
django-cors-headers~=4.2.0 |
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,33 @@ | ||
version: '3' | ||
services: | ||
db: | ||
image: postgres:15 | ||
ports: | ||
- "8001:5432" | ||
environment: | ||
POSTGRES_USER: catchpy | ||
POSTGRES_PASSWORD: catchpy | ||
POSTGRES_DB: catchpy | ||
web: | ||
build: | ||
context: . | ||
dockerfile: test.Dockerfile | ||
image: hx/catchpy:test | ||
command: ["./wait-for-it.sh", "db:5432", "--", "python", "manage.py", "runserver", "0.0.0.0:8000"] | ||
volumes: | ||
- .:/code | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
- db | ||
environment: | ||
CATCHPY_DOTENV_PATH: "/code/docker_dotenv.env" | ||
networks: | ||
default: | ||
public: | ||
aliases: | ||
- catchpy.localhost | ||
|
||
networks: | ||
public: | ||
|
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,29 @@ | ||
FROM python:3.11 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
RUN apt-get update | ||
|
||
# Include fortune library for quote generation for text annotations | ||
RUN apt-get install fortune-mod -y | ||
ENV PATH "$PATH:/usr/games" | ||
|
||
# Install all other versions of Python we want to test with tox | ||
RUN git clone https://github.com/pyenv/pyenv /root/.pyenv | ||
RUN for PYTHON_VERSION in 3.8.17 3.9.17 3.10.12 3.11.4 3.12.0b4; do \ | ||
set -ex \ | ||
&& /root/.pyenv/bin/pyenv install ${PYTHON_VERSION} \ | ||
&& /root/.pyenv/versions/${PYTHON_VERSION}/bin/python -m pip install --upgrade pip \ | ||
; done | ||
|
||
# Add to PATH, in order of lowest precedence to highest. | ||
ENV PATH /root/.pyenv/versions/3.8.17/bin:${PATH} | ||
ENV PATH /root/.pyenv/versions/3.9.17/bin:${PATH} | ||
ENV PATH /root/.pyenv/versions/3.10.12/bin:${PATH} | ||
ENV PATH /root/.pyenv/versions/3.12.0b4/bin:${PATH} | ||
ENV PATH /root/.pyenv/versions/3.11.4/bin:${PATH} | ||
|
||
RUN mkdir /code | ||
WORKDIR /code | ||
ADD . /code | ||
|
||
RUN pip install -r catchpy/requirements/test.txt |
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,10 @@ | ||
[tox] | ||
envlis = py35, py36 | ||
|
||
env_list = | ||
py38 | ||
py39 | ||
py310 | ||
py311 | ||
py312 | ||
|
||
[testenv] | ||
deps = | ||
|