File tree Expand file tree Collapse file tree 6 files changed +53
-18
lines changed Expand file tree Collapse file tree 6 files changed +53
-18
lines changed Original file line number Diff line number Diff line change 1
1
.idea
2
- .env
2
+ * .env
3
3
4
4
* .png
5
5
* .jpg
Original file line number Diff line number Diff line change 1
1
FROM python:3.11-slim-buster
2
2
3
- RUN apt update
4
- RUN apt install libgl1 libglib2.0-0 -y
3
+ RUN apt update && apt install libgl1 libglib2.0-0 -y
5
4
6
5
RUN useradd -ms /bin/bash api
7
6
USER api
@@ -12,5 +11,3 @@ ENV PATH=/home/api/.local/bin:${PATH}
12
11
COPY pyproject.toml poetry.lock ./
13
12
RUN poetry install
14
13
COPY . ./
15
-
16
- CMD poetry run gunicorn go_capture.wsgi:application --bind 0.0.0.0:8000 -t 60
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- export image_hash=$1
3
- export account_id=$( aws sts get-caller-identity --query Account --output text)
4
- aws ecr get-login-password | docker login --username AWS --password-stdin ${account_id} .dkr.ecr.us-west-1.amazonaws.com \
5
- && docker compose down \
6
- && docker compose up -d
2
+ export IMAGE=$1
3
+ export TAG=$2
4
+ echo echo " Take down old api version..." \
5
+ && docker compose -f docker-compose-prod.yml down \
6
+ && echo " Bring up new api version..." \
7
+ && docker compose -f docker-compose-prod.yml -p go-capture-api up -d
Original file line number Diff line number Diff line change @@ -3,11 +3,15 @@ services:
3
3
build : .
4
4
command : " poetry run python3 /api/manage.py runserver 0.0.0.0:8000"
5
5
env_file :
6
- - .env
6
+ - env/dev .env
7
7
environment :
8
8
- CELERY_BROKER_URL=amqp://guest:guest@broker:5672
9
+ - FIREBASE_CREDENTIALS_FILE=/run/secrets/firebase-credentials
10
+ - MEDIA_ROOT=/api/media
9
11
ports :
10
12
- 8000:8000
13
+ secrets :
14
+ - firebase-credentials
11
15
volumes :
12
16
- .:/api
13
17
worker :
@@ -18,12 +22,20 @@ services:
18
22
environment :
19
23
- CELERY_BROKER_URL=amqp://guest:guest@broker:5672
20
24
- CELERY_RESULT_BACKEND=rpc
25
+ - FIREBASE_CREDENTIALS_FILE=/run/secrets/firebase-credentials
26
+ - MEDIA_ROOT=/api/media
21
27
env_file :
22
- - .env
28
+ - env/dev.env
29
+ secrets :
30
+ - firebase-credentials
23
31
volumes :
24
32
- .:/api
25
33
broker :
26
34
image : rabbitmq:3-management
27
35
ports :
28
36
- 5672:5672
29
37
- 15672:15672
38
+
39
+ secrets :
40
+ firebase-credentials :
41
+ file : $FIREBASE_CREDENTIALS_FILE
Original file line number Diff line number Diff line change 1
1
services :
2
2
api :
3
- image : ${image}:${tag}
4
- env_file :
5
- - .env
3
+ command : " poetry run gunicorn go_capture.wsgi:application --bind 0.0.0.0:8000 -t 60"
6
4
environment :
7
5
- CELERY_BROKER_URL=amqp://guest:guest@broker:5672
6
+ - FIREBASE_CREDENTIALS_FILE=/run/secrets/firebase-credentials
7
+ - MEDIA_ROOT=/api/media
8
+ env_file :
9
+ - env/prod.env
10
+ image : ${IMAGE}:${TAG}
8
11
ports :
9
12
- 8000:8000
13
+ secrets :
14
+ - firebase-credentials
15
+ volumes :
16
+ - media:/api/media
10
17
worker :
11
- image : ${image}:${tag}
12
18
command : " poetry run celery -A go_capture.tasks worker"
13
19
depends_on :
14
20
- broker
15
21
environment :
16
22
- CELERY_BROKER_URL=amqp://guest:guest@broker:5672
17
23
- CELERY_RESULT_BACKEND=rpc
24
+ - FIREBASE_CREDENTIALS_FILE=/run/secrets/firebase-credentials
25
+ - MEDIA_ROOT=/api/media
18
26
env_file :
19
- - .env
27
+ - env/prod.env
28
+ image : ${IMAGE}:${TAG}
29
+ secrets :
30
+ - firebase-credentials
31
+ volumes :
32
+ - media:/api/media
20
33
broker :
21
34
image : rabbitmq:3-management
22
35
ports :
23
36
- 5672:5672
24
37
- 15672:15672
38
+
39
+ volumes :
40
+ media :
41
+ driver : local
42
+ driver_opts :
43
+ type : none
44
+ o : bind
45
+ device : $MEDIA_ROOT
46
+
47
+ secrets :
48
+ firebase-credentials :
49
+ file : $FIREBASE_CREDENTIALS_FILE
Original file line number Diff line number Diff line change 125
125
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
126
126
127
127
MEDIA_URL = "media/"
128
- MEDIA_ROOT = BASE_DIR / "media"
128
+ MEDIA_ROOT = env . path ( "MEDIA_ROOT" )
129
129
MEDIA_ROOT .mkdir (exist_ok = True )
130
130
131
131
IMAGES_DIR = MEDIA_ROOT / "images"
You can’t perform that action at this time.
0 commit comments