Skip to content

Commit 674b444

Browse files
authored
test: docker test (#60)
* chore: Remove workflow as it's not really doing a lot * chore: Some good practice updates to Dockerfile * test: Run the docker processes that people need to be able to run
1 parent a39c859 commit 674b444

File tree

3 files changed

+60
-63
lines changed

3 files changed

+60
-63
lines changed

.github/workflows/docker.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Docker test suite
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
pytest:
16+
name: Docker test build
17+
# List of supported runners:
18+
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Pre-build container images
25+
run: |
26+
docker network create djangocmsnet
27+
docker compose build --force-rm
28+
29+
- name: Run the containers
30+
run: |
31+
docker compose build web
32+
docker compose up database_default -d
33+
sleep 2s
34+
docker compose run web python manage.py migrate
35+
docker compose up -d
36+
37+
- name: 'debug: Display state and logs'
38+
if: always()
39+
run: |
40+
docker compose ps
41+
docker compose logs web
42+
docker compose logs database_default
43+
44+
- name: Execute django check
45+
run: docker compose exec -w /app web python manage.py check --deploy
46+
47+
- name: Execute test suite
48+
run: docker compose exec -w /app web python manage.py test
49+
50+
- name: Terminate all components
51+
if: always()
52+
run: docker compose down -v

.github/workflows/pythonpackage.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
FROM python:3.11
2+
23
WORKDIR /app
3-
COPY . /app
4-
RUN pip install -r requirements.txt
4+
5+
COPY . .
6+
7+
RUN python -m pip install --upgrade pip
8+
RUN python -m pip install -r requirements.txt
9+
510
RUN python manage.py collectstatic --noinput
11+
612
CMD uwsgi --http=0.0.0.0:80 --module=backend.wsgi

0 commit comments

Comments
 (0)