datasette/demos/apache-proxy/Dockerfile

47 wiersze
1.0 KiB
Docker
Czysty Zwykły widok Historia

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
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\
\n\
<Proxy *>\n\
Order deny,allow\n\
Allow from all\n\
</Proxy>\n\
\n\
ProxyPreserveHost On\n\
2021-11-20 00:34:35 +00:00
ProxyPass /prefix/ http://localhost:8001/\n\
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
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\
\n\
2021-11-20 00:34:35 +00:00
httpd -D FOREGROUND & \n\
\n\
2021-11-20 00:34:35 +00:00
wait -n\n\
exit $?" > /app/start.sh
RUN chmod +x /app/start.sh
EXPOSE 80
2021-11-20 00:34:35 +00:00
CMD /tini -- /app/start.sh