Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 5a2664d

Browse files
committed
Generate secret_key randomly in the Dockerfile
1 parent 307e76d commit 5a2664d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
FROM ubuntu
22

3-
RUN sed 's/main$/main universe/' -i /etc/apt/sources.list && apt-get update
3+
RUN sed -i 's/main$/main universe/' /etc/apt/sources.list && apt-get update
44
RUN apt-get install -y git-core python-pip build-essential python-dev libevent1-dev -y
55
ADD . /docker-registry
66

77
RUN cd /docker-registry && pip install -r requirements.txt
88
RUN cp --no-clobber /docker-registry/config_sample.yml /docker-registry/config.yml
9+
RUN sed "s/ secret_key: REPLACEME/ secret_key: $(< /dev/urandom tr -dc A-Za-z0-9 | head -c 32)/" /docker-registry/config.yml
910

1011
EXPOSE 5000
1112

12-
CMD cd /docker-registry && ./setup-configs.sh && gunicorn --access-logfile - --debug --max-requests 100 --graceful-timeout 3600 -t 3600 -k gevent -b 0.0.0.0:5000 -w 2 wsgi:application
13+
CMD cd /docker-registry && ./setup-configs.sh && gunicorn --access-logfile - --debug --max-requests 100 --graceful-timeout 3600 -t 3600 -k gevent -b 0.0.0.0:5000 -w 4 wsgi:application

setup-configs.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
if [[ -z "$GUNICORN_WORKERS" ]] ; then
4-
GUNICORN_WORKERS=2
4+
GUNICORN_WORKERS=4
55
fi
66

77
if [ "$SETTINGS_FLAVOR" = "prod" ] ; then

0 commit comments

Comments
 (0)