2021-11-19 22:50:06 +00:00
|
|
|
FROM python:3-alpine
|
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
apache2 \
|
|
|
|
apache2-proxy \
|
|
|
|
bash
|
|
|
|
|
2021-11-20 00:34:35 +00:00
|
|
|
ARG DATASETTE_REF
|
|
|
|
|
|
|
|
RUN pip install https://github.com/simonw/datasette/archive/${DATASETTE_REF}.zip
|
2021-11-19 22:50:06 +00:00
|
|
|
|
|
|
|
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
|
2021-11-20 00:34:35 +00:00
|
|
|
RUN echo -e 'ServerName localhost\n\
|
2021-11-19 22:50:06 +00:00
|
|
|
\n\
|
|
|
|
<Proxy *>\n\
|
|
|
|
Order deny,allow\n\
|
|
|
|
Allow from all\n\
|
|
|
|
</Proxy>\n\
|
|
|
|
\n\
|
2021-11-20 01:11:13 +00:00
|
|
|
ProxyPreserveHost On\n\
|
2021-11-20 00:34:35 +00:00
|
|
|
ProxyPass /prefix/ http://localhost:8001/\n\
|
2021-11-19 22:50:06 +00:00
|
|
|
Header add X-Proxied-By "Apache2"' >> /etc/apache2/httpd.conf
|
|
|
|
|
2021-11-20 00:34:35 +00:00
|
|
|
RUN echo '<a href="/prefix/">Datasette</a>' > /var/www/localhost/htdocs/index.html
|
2021-11-19 22:50:06 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
ADD https://latest.datasette.io/fixtures.db /app/fixtures.db
|
|
|
|
|
2021-11-20 00:34:35 +00:00
|
|
|
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\
|
2021-11-19 22:50:06 +00:00
|
|
|
\n\
|
2021-11-20 00:34:35 +00:00
|
|
|
httpd -D FOREGROUND & \n\
|
2021-11-19 22:50:06 +00:00
|
|
|
\n\
|
2021-11-20 00:34:35 +00:00
|
|
|
wait -n\n\
|
|
|
|
exit $?" > /app/start.sh
|
2021-11-19 22:50:06 +00:00
|
|
|
|
|
|
|
RUN chmod +x /app/start.sh
|
|
|
|
|
|
|
|
EXPOSE 80
|
2021-11-20 00:34:35 +00:00
|
|
|
|
|
|
|
CMD /tini -- /app/start.sh
|