Skip to content

Commit db0b89e

Browse files
committed
chg: [docker] Baseline docker config for development/staging deployment
1 parent 31a6931 commit db0b89e

File tree

8 files changed

+111
-26
lines changed

8 files changed

+111
-26
lines changed

Dockerfile

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

compose/staging/.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ONEKEY_API_EMAIL="romain.kieffer@nc3.lu"
2+
ONEKEY_API_PASSWORD="testing_platform_1key!"
3+

compose/staging/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ARG PYTHON_VERSION
2+
FROM python:${PYTHON_VERSION}
3+
ARG DEBUG
4+
ENV PYTHONUNBUFFERED 1
5+
6+
ENV APP_ROOT /var/www/testing_platform
7+
WORKDIR ${APP_ROOT}
8+
9+
COPY ../../requirements.txt ${APP_ROOT}
10+
11+
RUN pip3 install -r ${APP_ROOT}/requirements.txt
12+
RUN apt-get update && \
13+
apt-get install -y --no-install-recommends \
14+
iputils-ping nmap && \
15+
apt-get clean && \
16+
rm -rf /var/lib/apt/lists/*
17+
18+
EXPOSE 8000
19+
20+
COPY ../.. ${APP_ROOT}
21+
COPY compose/staging/entrypoint.sh ${APP_ROOT}
22+
23+
ENTRYPOINT [ "/var/www/testing_platform/entrypoint.sh" ]

compose/staging/docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
services:
2+
3+
testing-platform:
4+
build:
5+
context: ../..
6+
dockerfile: compose/staging/Dockerfile
7+
args:
8+
- DEBUG=1
9+
- PYTHON_VERSION=3.12
10+
cache_from:
11+
- testing-platform:app
12+
image: "testing-platform:app"
13+
command: gunicorn testing_platform.wsgi:application --bind 0.0.0.0:8000
14+
volumes:
15+
- ../../static:/var/www/testing_platform/static
16+
expose:
17+
- 8000
18+
19+
nginx:
20+
build:
21+
context: ../../nginx
22+
cache_from:
23+
- testing-platform:nginx
24+
image: "testing-platform:nginx"
25+
volumes:
26+
- ../../static:/var/www/testing_platform/static
27+
ports:
28+
- '80:80'
29+
depends_on:
30+
- testing-platform
31+
32+
volumes:
33+
static:

compose/staging/entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
python manage.py migrate
4+
python manage.py collectstatic --noinput
5+
exec python manage.py runserver 0.0.0.0:8000
6+

nginx/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM nginx:1.27.5-alpine
2+
3+
RUN rm /etc/nginx/conf.d/default.conf
4+
COPY nginx.conf /etc/nginx/conf.d

nginx/nginx.conf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
upstream testing-platform {
2+
server testing-platform:8000;
3+
}
4+
5+
server {
6+
listen 80;
7+
server_name testing.office.lhc.lu;
8+
9+
location / {
10+
proxy_pass http://testing-platform;
11+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
12+
proxy_set_header Host $host;
13+
proxy_redirect off;
14+
}
15+
16+
location /static/ {
17+
alias /var/www/testing_platform/static/;
18+
}
19+
20+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
upstream testing-platform {
2+
server 127.0.0.1:8000;
3+
}
4+
5+
server {
6+
listen 80;
7+
server_name testing.develop.office.lhc.lu;
8+
9+
location / {
10+
proxy_pass http://testing.develop;
11+
proxy_read_timeout 300;
12+
proxy_redirect off;
13+
proxy_buffering off;
14+
proxy_store off;
15+
proxy_set_header Host $host;
16+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
17+
}
18+
19+
location /static/ {
20+
alias /var/www/testing_platform/static/;
21+
}
22+
}

0 commit comments

Comments
 (0)