зеркало из https://github.com/mozilla/bedrock.git
Add supervisor to docker for dev/demo
Allows us to run cron process and the server in one container.
This commit is contained in:
Родитель
47720aac5c
Коммит
6ee727152d
15
Dockerfile
15
Dockerfile
|
@ -1,13 +1,16 @@
|
|||
from mozorg/bedrock_base
|
||||
|
||||
RUN apt-get install -y --no-install-recommends npm
|
||||
|
||||
COPY . /app
|
||||
|
||||
COPY ./node_modules ./
|
||||
COPY package.json ./
|
||||
RUN npm install --production
|
||||
|
||||
COPY ./requirements/ ./requirements/
|
||||
RUN pip install --no-cache-dir -r requirements/dev.txt
|
||||
RUN pip install --no-cache-dir -r requirements/prod.txt
|
||||
RUN pip install --no-cache-dir -r requirements/docker.txt
|
||||
RUN pip install --no-cache-dir -r requirements/docker-dev.txt
|
||||
|
||||
COPY . ./
|
||||
|
||||
RUN ./manage.py collectstatic -l --noinput
|
||||
|
||||
|
@ -18,5 +21,7 @@ RUN ./docker/bin/softlinkstatic.py
|
|||
RUN bash -c "if [[ ! -e locale ]]; then git clone --depth 1 https://github.com/mozilla-l10n/bedrock-l10n locale; fi"
|
||||
|
||||
# Change User
|
||||
# No USER directive since supervisor is set to run processes as webdev
|
||||
RUN chown webdev.webdev -R .
|
||||
USER webdev
|
||||
|
||||
CMD ["docker/run-supervisor.sh"]
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -xe
|
||||
|
||||
enable_proc() {
|
||||
cp "etc/supervisor_available/$1.conf" "etc/supervisor_enabled/$1.conf"
|
||||
}
|
||||
|
||||
DEV=$(echo "$DEV" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
enable_proc bedrock
|
||||
[[ "$DEV" == "true" ]] && enable_proc cron || true
|
||||
|
||||
exec supervisord -c etc/supervisord.conf
|
|
@ -0,0 +1,8 @@
|
|||
[program:bedrock]
|
||||
command = /app/docker/run-prod.sh
|
||||
numprocs = 1
|
||||
autostart = true
|
||||
user = webdev
|
||||
redirect_stderr = true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
|
@ -0,0 +1,8 @@
|
|||
[program:cron]
|
||||
command = /app/bin/cron.py
|
||||
numprocs = 1
|
||||
autostart = true
|
||||
user = webdev
|
||||
redirect_stderr = true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
|
@ -0,0 +1 @@
|
|||
*.conf
|
|
@ -0,0 +1,5 @@
|
|||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[include]
|
||||
files = supervisor_enabled/*.conf
|
|
@ -0,0 +1,5 @@
|
|||
supervisor==3.2.3 \
|
||||
--hash=sha256:3d6f0304c8ce74ab2100dfc4ab0f70050568504216f9508a81b8ed269aec9705
|
||||
meld3==1.0.2 \
|
||||
--hash=sha256:b28a9bfac342aadb4557aa144bea9f8e6208bfb0596190570d10a892d35ff7dc \
|
||||
--hash=sha256:f7b754a0fde7a4429b2ebe49409db240b5699385a572501bb0d5627d299f9558
|
Загрузка…
Ссылка в новой задаче