File tree Expand file tree Collapse file tree 11 files changed +145
-43
lines changed Expand file tree Collapse file tree 11 files changed +145
-43
lines changed Original file line number Diff line number Diff line change
1
+ name : Create and publish a Docker image
2
+
3
+ on :
4
+ push :
5
+ branches : ["main"]
6
+
7
+ env :
8
+ REGISTRY : ghcr.io
9
+ IMAGE_NAME : ${{ github.repository }}
10
+
11
+ jobs :
12
+ build-and-push-image :
13
+ runs-on : ubuntu-latest
14
+ permissions :
15
+ contents : read
16
+ packages : write
17
+
18
+ steps :
19
+ - name : Checkout repository
20
+ uses : actions/checkout@v4
21
+
22
+ - name : Log in to the Container registry
23
+ uses : docker/login-action@v3
24
+ with :
25
+ registry : ${{ env.REGISTRY }}
26
+ username : ${{ github.actor }}
27
+ password : ${{ secrets.GITHUB_TOKEN }}
28
+
29
+ - name : Extract metadata (tags, labels) for Docker
30
+ id : meta
31
+ uses : docker/metadata-action@v5
32
+ with :
33
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34
+ flavor : |
35
+ latest=true
36
+ tags : |
37
+ type=ref,event=branch
38
+ type=sha
39
+
40
+ - name : Build and push Docker image
41
+ uses : docker/build-push-action@v6
42
+ with :
43
+ context : .
44
+ push : true
45
+ tags : ${{ steps.meta.outputs.tags }}
46
+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
1
+ name : Docker test build
2
+
3
+ on :
4
+ pull_request :
5
+ push :
6
+ branches :
7
+ - main
8
+
9
+ concurrency :
10
+ group : ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress : true
12
+
13
+ permissions :
14
+ contents : read
15
+
16
+ jobs :
17
+ build-image :
18
+ runs-on : ubuntu-latest
19
+
20
+ strategy :
21
+ matrix :
22
+ req_file :
23
+ - prod.txt
24
+ - tests.txt
25
+
26
+ # steps taken (and trimmed) from docker-publish.yml
27
+ steps :
28
+ - name : Checkout repository
29
+ uses : actions/checkout@v4
30
+
31
+ - name : Test docker image build (local development)
32
+ uses : docker/build-push-action@v6
33
+ with :
34
+ context : .
35
+ push : false
36
+ build-args : |
37
+ REQ_FILE=requirements/${{ matrix.req_file }}
Original file line number Diff line number Diff line change 9
9
10
10
jobs :
11
11
tests :
12
- runs-on : ubuntu-20 .04
12
+ runs-on : ubuntu-24 .04
13
13
strategy :
14
14
fail-fast : false
15
15
29
29
steps :
30
30
- uses : actions/checkout@v2
31
31
- name : Set up Python
32
- uses : actions/setup-python@v2
32
+ uses : actions/setup-python@v5
33
33
with :
34
- python-version : 3.8
34
+ python-version : " 3.8"
35
35
- name : Install dependencies
36
36
run : |
37
37
python -m pip install --upgrade pip setuptools coveralls "tox<4"
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ locale/*/LC_MESSAGES/django.mo
10
10
* /locale /* /LC_MESSAGES /django.mo
11
11
.sass-cache /
12
12
.coverage
13
+ .direnv
14
+ .envrc
13
15
.tox
14
16
djangoproject /cache
15
17
djangoproject /static /js /lib /jquery-flot /examples
Original file line number Diff line number Diff line change @@ -13,13 +13,17 @@ RUN apt-get update \
13
13
&& apt-get install --assume-yes --no-install-recommends \
14
14
gettext \
15
15
git \
16
+ libpq5 \
16
17
make \
17
18
netcat-openbsd \
18
19
npm \
19
20
postgresql-client-13 \
20
21
rsync \
22
+ zlib1g \
21
23
&& rm -rf /var/lib/apt/lists/*
22
24
25
+ ARG REQ_FILE=requirements/prod.txt
26
+
23
27
# install python dependencies
24
28
COPY ./requirements ./requirements
25
29
RUN apt-get update \
@@ -28,22 +32,21 @@ RUN apt-get update \
28
32
gcc \
29
33
libc6-dev \
30
34
libpq-dev \
31
- && python3 -m pip install --no-cache-dir -r requirements/tests.txt \
35
+ zlib1g-dev \
36
+ && python3 -m pip install --no-cache-dir -r ${REQ_FILE} \
32
37
&& apt-get purge --assume-yes --auto-remove \
33
38
gcc \
34
39
libc6-dev \
35
40
libpq-dev \
41
+ zlib1g-dev \
36
42
&& rm -rf /var/lib/apt/lists/*
37
43
38
44
# install node dependencies
39
45
COPY ./package.json ./package.json
40
46
RUN npm install
41
47
42
- # copy docker-entrypoint.sh
43
- COPY ./docker-entrypoint.sh ./docker-entrypoint.sh
44
-
45
48
# copy project
46
49
COPY . .
47
50
48
51
# run docker-entrypoint.sh
49
- ENTRYPOINT ["./docker-entrypoint.sh" ]
52
+ ENTRYPOINT ["./docker-entrypoint.prod. sh" ]
Original file line number Diff line number Diff line change 1
1
from .common import * # noqa
2
2
3
+ DOMAIN_NAME = os .getenv ("DOMAIN_NAME" , "djangoproject.com" )
4
+
3
5
ALLOWED_HOSTS = [
4
- "www.djangoproject.com " ,
5
- "djangoproject.com" ,
6
- "docs.djangoproject.com " ,
7
- "dashboard.djangoproject.com " ,
6
+ f "www.{ DOMAIN_NAME } " ,
7
+ DOMAIN_NAME ,
8
+ f "docs.{ DOMAIN_NAME } " ,
9
+ f "dashboard.{ DOMAIN_NAME } " ,
8
10
] + SECRETS .get ("allowed_hosts" , [])
9
11
10
- LOCALE_MIDDLEWARE_EXCLUDED_HOSTS = ["docs.djangoproject.com " ]
12
+ LOCALE_MIDDLEWARE_EXCLUDED_HOSTS = [f "docs.{ DOMAIN_NAME } " ]
11
13
12
- DEBUG = False
14
+ DEBUG = os . getenv ( "DJANGO_DEBUG" , "false" ). lower () == "true"
13
15
THUMBNAIL_DEBUG = DEBUG
14
16
15
17
CACHES = {
37
39
38
40
MEDIA_ROOT = str (DATA_DIR .joinpath ("media" ))
39
41
40
- MEDIA_URL = "https://media.djangoproject.com /"
42
+ MEDIA_URL = f "https://media.{ DOMAIN_NAME } /"
41
43
42
44
MIDDLEWARE = (
43
45
["django.middleware.cache.UpdateCacheMiddleware" ]
58
60
59
61
STATIC_ROOT = str (DATA_DIR .joinpath ("static" ))
60
62
61
- STATIC_URL = "https://static.djangoproject.com /"
63
+ STATIC_URL = f "https://static.{ DOMAIN_NAME } /"
62
64
63
65
# Docs settings
64
66
DOCS_BUILD_ROOT = DATA_DIR .joinpath ("data" , "docbuilds" )
67
69
68
70
HOST_SCHEME = "https"
69
71
70
- PARENT_HOST = "djangoproject.com"
72
+ PARENT_HOST = DOMAIN_NAME
71
73
72
74
# django-push settings
73
75
Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ services:
5
5
build :
6
6
context : ./
7
7
dockerfile : Dockerfile
8
+ args :
9
+ - REQ_FILE=requirements/tests.txt
10
+ entrypoint : docker-entrypoint.dev.sh
8
11
command : python manage.py runserver 0.0.0.0:8000
9
12
volumes :
10
13
- .:/usr/src/app/
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ echo " Waiting for postgres..."
4
+
5
+ while ! nc -z db 5432; do
6
+ sleep 0.1
7
+ done
8
+
9
+ echo " PostgreSQL started"
10
+
11
+ python -m manage flush --no-input
12
+ # PGPASSWORD=djangoproject psql --host db --port 5432 --username=code.djangoproject --dbname=code.djangoproject < tracdb/trac.sql
13
+ python -m manage migrate
14
+ make compile-scss # must come before collectstatic
15
+ python -m manage collectstatic --no-input --clear
16
+ python -m manage loaddata dev_sites
17
+ python -m manage loaddata doc_releases
18
+ # git config --global url."https://".insteadOf git://
19
+ # python -m manage update_docs
20
+ python -m manage loaddata dashboard_production_metrics
21
+ # python -m manage loaddata dashboard_example_data
22
+ python -m manage update_metrics
23
+ # python -m manage update_index
24
+
25
+ exec " $@ "
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ python -m manage migrate
4
+ python -m manage compilemessages
5
+ make compile-scss # must come before collectstatic
6
+ python -m manage collectstatic --no-input --clear
7
+
8
+ exec " $@ "
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments