Files
nginx-cache/Dockerfile

22 lines
1005 B
Docker

FROM openresty/openresty:alpine
# Copy config (OpenResty uses this path)
COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
# HTML and data dirs (config references /usr/share/nginx/html and /etc/nginx/data)
RUN mkdir -p /usr/share/nginx/html /etc/nginx/data/cache /etc/nginx/data/temp
COPY index.html /usr/share/nginx/html/index.html
# When volume is mounted at /etc/nginx/data, ensure cache/temp exist and are writable (fix rename Permission denied)
RUN echo '#!/bin/sh' > /docker-entrypoint.sh \
&& echo 'set -e' >> /docker-entrypoint.sh \
&& echo 'mkdir -p /etc/nginx/data/cache /etc/nginx/data/temp' >> /docker-entrypoint.sh \
&& echo 'chown -R nobody:nobody /etc/nginx/data 2>/dev/null || true' >> /docker-entrypoint.sh \
&& echo 'chmod -R 755 /etc/nginx/data' >> /docker-entrypoint.sh \
&& echo 'exec "$@"' >> /docker-entrypoint.sh \
&& chmod +x /docker-entrypoint.sh
EXPOSE 3000
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]