mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Switch from Alpine to Debian, refs #1522
This commit is contained in:
parent
24b5006ad7
commit
494f11d5cc
1 changed files with 49 additions and 31 deletions
|
|
@ -1,46 +1,64 @@
|
||||||
FROM python:3-alpine
|
FROM python:3.9.7-slim-bullseye
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apt-get update && \
|
||||||
apache2 \
|
apt-get install -y apache2 supervisor && \
|
||||||
apache2-proxy \
|
apt clean && \
|
||||||
bash
|
rm -rf /var/lib/apt && \
|
||||||
|
rm -rf /var/lib/dpkg/info/*
|
||||||
|
|
||||||
|
# Apache environment, copied from
|
||||||
|
# https://github.com/ijklim/laravel-benfords-law-app/blob/e9bf385dcaddb62ea466a7b245ab6e4ef708c313/docker/os/Dockerfile
|
||||||
|
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
|
||||||
|
ENV APACHE_RUN_USER www-data
|
||||||
|
ENV APACHE_RUN_GROUP www-data
|
||||||
|
ENV APACHE_PID_FILE /var/run/apache2.pid
|
||||||
|
ENV APACHE_RUN_DIR /var/run/apache2
|
||||||
|
ENV APACHE_LOCK_DIR /var/lock/apache2
|
||||||
|
ENV APACHE_LOG_DIR /var/log
|
||||||
|
RUN ln -sf /dev/stdout /var/log/apache2-access.log
|
||||||
|
RUN ln -sf /dev/stderr /var/log/apache2-error.log
|
||||||
|
RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR
|
||||||
|
|
||||||
|
RUN a2enmod proxy
|
||||||
|
RUN a2enmod proxy_http
|
||||||
|
RUN a2enmod headers
|
||||||
|
|
||||||
ARG DATASETTE_REF
|
ARG DATASETTE_REF
|
||||||
|
|
||||||
RUN pip install https://github.com/simonw/datasette/archive/${DATASETTE_REF}.zip
|
RUN pip install https://github.com/simonw/datasette/archive/${DATASETTE_REF}.zip
|
||||||
|
|
||||||
ENV TINI_VERSION v0.18.0
|
|
||||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini
|
|
||||||
RUN chmod +x /tini
|
|
||||||
|
|
||||||
# Append this to the end of the default httpd.conf file
|
# Append this to the end of the default httpd.conf file
|
||||||
RUN echo -e 'ServerName localhost\n\
|
RUN echo '\n\
|
||||||
|
<Directory /app/html/>\n\
|
||||||
|
Options Indexes FollowSymLinks\n\
|
||||||
|
AllowOverride None\n\
|
||||||
|
Require all granted\n\
|
||||||
|
</Directory>\n\
|
||||||
\n\
|
\n\
|
||||||
<Proxy *>\n\
|
<VirtualHost *:80>\n\
|
||||||
Order deny,allow\n\
|
ServerName localhost\n\
|
||||||
Allow from all\n\
|
DocumentRoot /app/html\n\
|
||||||
</Proxy>\n\
|
ProxyPreserveHost On\n\
|
||||||
\n\
|
ProxyPass /prefix/ http://127.0.0.1:8001/\n\
|
||||||
ProxyPreserveHost On\n\
|
Header add X-Proxied-By "Apache2 Debian"\n\
|
||||||
ProxyPass /prefix/ http://localhost:8001/\n\
|
</VirtualHost>\n\
|
||||||
Header add X-Proxied-By "Apache2"' >> /etc/apache2/httpd.conf
|
' > /etc/apache2/sites-enabled/000-default.conf
|
||||||
|
|
||||||
RUN echo '<a href="/prefix/">Datasette</a>' > /var/www/localhost/htdocs/index.html
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
RUN mkdir -p /app/html
|
||||||
|
RUN echo '<a href="/prefix/">Datasette</a>' > /app/html/index.html
|
||||||
|
|
||||||
ADD https://latest.datasette.io/fixtures.db /app/fixtures.db
|
ADD https://latest.datasette.io/fixtures.db /app/fixtures.db
|
||||||
|
|
||||||
RUN echo -e "#!/usr/bin/env bash\n\
|
|
||||||
datasette /app/fixtures.db --setting base_url '/prefix/' --version-note '${DATASETTE_REF}' -h 0.0.0.0 -p 8001 &\n\
|
|
||||||
\n\
|
|
||||||
httpd -D FOREGROUND & \n\
|
|
||||||
\n\
|
|
||||||
wait -n\n\
|
|
||||||
exit $?" > /app/start.sh
|
|
||||||
|
|
||||||
RUN chmod +x /app/start.sh
|
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
CMD /tini -- /app/start.sh
|
RUN echo "[supervisord]" >> /app/supervisord.conf
|
||||||
|
RUN echo "nodaemon=true" >> /app/supervisord.conf
|
||||||
|
RUN echo "" >> /app/supervisord.conf
|
||||||
|
RUN echo "[program:apache2]" >> /app/supervisord.conf
|
||||||
|
RUN echo "command=apache2 -D FOREGROUND" >> /app/supervisord.conf
|
||||||
|
RUN echo "" >> /app/supervisord.conf
|
||||||
|
RUN echo "[program:datasette]" >> /app/supervisord.conf
|
||||||
|
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
|
||||||
|
|
||||||
|
CMD ["/usr/bin/supervisord", "-c", "/app/supervisord.conf"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue