@@ -6,8 +6,9 @@ ARG DEBIAN_FRONTEND=noninteractive
66ENV APP_DIR=/srv/keys COMPOSER_ALLOW_SUPERUSER=1
77
88RUN apt-get update && apt-get install -y --no-install-recommends \
9- nginx php-fpm php-cli php-mysql php-ldap php-mbstring php-gmp php-xml php-zip php-curl php-gd \
10- php-intl php-bcmath composer cron supervisor tini ca-certificates curl openssh-client && rm -rf /var/lib/apt/lists/*
9+ nginx php-fpm php-cli php-mysql php-ldap php-mbstring php-gmp php-xml php-zip php-curl php-gd php-intl php-bcmath \
10+ composer cron supervisor tini ca-certificates curl openssh-client \
11+ && rm -rf /var/lib/apt/lists/*
1112
1213RUN useradd --system --home /var/lib/keys-sync --shell /usr/sbin/nologin keys-sync && \
1314 mkdir -p /var/lib/keys-sync /var/log/ska /var/local/keys-sync /var/log/supervisor && \
@@ -33,121 +34,7 @@ RUN set -eux; \
3334 chown www-data:www-data /run/php /var/lib/php/sessions; \
3435 chmod 1733 /var/lib/php/sessions
3536
36- RUN set -eux; \
37- cat <<'NGINX-EOF' >/etc/nginx/nginx.conf; printf '\n ' >>/etc/nginx/nginx.conf
38- worker_processes auto;
39-
40- error_log /dev/stderr info;
41-
42- pid /run/nginx.pid;
43-
44- events {
45- worker_connections 1024;
46- }
47-
48- http {
49- include /etc/nginx/mime.types;
50- default_type application/octet-stream;
51-
52- sendfile on;
53- keepalive_timeout 65;
54- server_tokens off;
55- client_max_body_size 16m;
56-
57- access_log /dev/stdout;
58- error_log /dev/stderr info;
59-
60- include /etc/nginx/conf.d/*.conf;
61-
62- server {
63- listen 8080 default_server;
64- listen [::]:8080 default_server;
65-
66- root /srv/keys/public_html;
67- index init.php;
68-
69- add_header X-Content-Type-Options nosniff;
70- add_header X-Frame-Options DENY;
71- add_header X-XSS-Protection "1; mode=block" ;
72-
73- location / {
74- try_files $uri $uri/ /init.php?$query_string;
75- }
76-
77- location ~ \. php$ {
78- include snippets/fastcgi-php.conf;
79- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
80- fastcgi_pass 127.0.0.1:9000;
81- }
82-
83- location ~* \. (css|js|png|jpg|jpeg|gif|svg|ico)$ {
84- expires 7d;
85- access_log off;
86- }
87- }
88- }
89- NGINX-EOF
90-
91- RUN set -eux; \
92- cat <<'CRON-EOF' >/etc/cron.d/ska; printf '\n ' >>/etc/cron.d/ska; chmod 0644 /etc/cron.d/ska
93- SHELL=/bin/bash
94- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
95-
96- */1 * * * * www-data /usr/bin/flock -n /tmp/ldap_update.lock /usr/bin/php /srv/keys/scripts/ldap_update.php >> /var/log/ska/ldap_update.log 2>&1
97- */5 * * * * www-data /usr/bin/flock -n /tmp/supervise_external_keys.lock /usr/bin/php /srv/keys/scripts/supervise_external_keys.php >> /var/log/ska/supervise_external_keys.log 2>&1
98- CRON-EOF
99-
100- RUN set -eux; cat <<'SUPERVISOR-EOF' >/etc/supervisor/conf.d/ska.conf
101- [program:php-fpm]
102- command=/usr/sbin/php-fpm -F
103- stopsignal=QUIT
104- autostart=true
105- autorestart=true
106- startsecs=5
107- stdout_logfile=/dev/stdout
108- stdout_logfile_maxbytes=0
109- stderr_logfile=/dev/stderr
110- stderr_logfile_maxbytes=0
111- priority=10
112-
113- [program:nginx]
114- command=/usr/sbin/nginx -g "daemon off;"
115- stopsignal=QUIT
116- autostart=true
117- autorestart=true
118- startsecs=5
119- stdout_logfile=/dev/stdout
120- stdout_logfile_maxbytes=0
121- stderr_logfile=/dev/stderr
122- stderr_logfile_maxbytes=0
123- priority=20
124-
125- [program:cron]
126- command=/usr/sbin/cron -f
127- autostart=true
128- autorestart=true
129- startsecs=5
130- stdout_logfile=/dev/stdout
131- stdout_logfile_maxbytes=0
132- stderr_logfile=/dev/stderr
133- stderr_logfile_maxbytes=0
134- priority=30
135-
136- [program:keys-syncd]
137- command=/usr/bin/php /srv/keys/scripts/syncd.php --systemd
138- directory=/srv/keys
139- user=keys-sync
140- # The 'startsecs' option tells Supervisor how many seconds the program must stay running after it is started to be considered successfully started.
141- # If the process exits before this time, Supervisor will consider it a failure and may attempt to restart it.
142- startsecs=5
143- autostart=true
144- autorestart=true
145- stdout_logfile=/dev/stdout
146- stdout_logfile_maxbytes=0
147- stderr_logfile=/dev/stderr
148- stderr_logfile_maxbytes=0
149- priority=40
150- SUPERVISOR-EOF
37+ RUN chmod 0644 /etc/cron.d/ska
15138
15239EXPOSE 8080
15340
0 commit comments