Debian Codegraph @

demos/apache-proxy/Dockerfile

raw
1 FROM python:3.11.0-slim-bullseye
2
3 RUN apt-get update && \
4 apt-get install -y apache2 supervisor && \
5 apt clean && \
6 rm -rf /var/lib/apt && \
7 rm -rf /var/lib/dpkg/info/*
8
9 # Apache environment, copied from
10 # https://github.com/ijklim/laravel-benfords-law-app/blob/e9bf385dcaddb62ea466a7b245ab6e4ef708c313/docker/os/Dockerfile
11 ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
12 ENV APACHE_RUN_USER www-data
13 ENV APACHE_RUN_GROUP www-data
14 ENV APACHE_PID_FILE /var/run/apache2.pid
15 ENV APACHE_RUN_DIR /var/run/apache2
16 ENV APACHE_LOCK_DIR /var/lock/apache2
17 ENV APACHE_LOG_DIR /var/log
18 RUN ln -sf /dev/stdout /var/log/apache2-access.log
19 RUN ln -sf /dev/stderr /var/log/apache2-error.log
20 RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR
21
22 RUN a2enmod proxy
23 RUN a2enmod proxy_http
24 RUN a2enmod headers
25
26 ARG DATASETTE_REF
27
28 RUN pip install \
29 https://github.com/simonw/datasette/archive/${DATASETTE_REF}.zip \
30 datasette-redirect-to-https datasette-debug-asgi
31
32 ADD 000-default.conf /etc/apache2/sites-enabled/000-default.conf
33
34 WORKDIR /app
35 RUN mkdir -p /app/html
36 RUN echo '<h1><a href="/prefix/">Demo is at /prefix/</a></h1>' > /app/html/index.html
37
38 ADD https://latest.datasette.io/fixtures.db /app/fixtures.db
39
40 EXPOSE 80
41
42 # Dynamically build supervisord config since it includes $DATASETTE_REF:
43 RUN echo "[supervisord]" >> /app/supervisord.conf
44 RUN echo "nodaemon=true" >> /app/supervisord.conf
45 RUN echo "" >> /app/supervisord.conf
46 RUN echo "[program:apache2]" >> /app/supervisord.conf
47 RUN echo "command=apache2 -D FOREGROUND" >> /app/supervisord.conf
48 RUN echo "stdout_logfile=/dev/stdout" >> /app/supervisord.conf
49 RUN echo "stdout_logfile_maxbytes=0" >> /app/supervisord.conf
50 RUN echo "" >> /app/supervisord.conf
51 RUN echo "[program:datasette]" >> /app/supervisord.conf
52 RUN echo "command=datasette /app/fixtures.db --setting base_url '/prefix/' --version-note '${DATASETTE_REF}' -h 0.0.0.0 -p 8001" >> /app/supervisord.conf
53 RUN echo "stdout_logfile=/dev/stdout" >> /app/supervisord.conf
54 RUN echo "stdout_logfile_maxbytes=0" >> /app/supervisord.conf
55
56 CMD ["/usr/bin/supervisord", "-c", "/app/supervisord.conf"]