Dockerfile 989 B

1234567891011121314151617181920212223242526272829303132
  1. FROM nginx:alpine
  2. LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
  3. COPY nginx.conf /etc/nginx/
  4. # If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
  5. ARG CHANGE_SOURCE=false
  6. RUN if [ ${CHANGE_SOURCE} = true ]; then \
  7. # Change application source from dl-cdn.alpinelinux.org to aliyun source
  8. sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
  9. ;fi
  10. RUN apk update \
  11. && apk upgrade \
  12. && apk add --no-cache openssl \
  13. && apk add --no-cache bash \
  14. && adduser -D -H -u 1000 -s /bin/bash www-data
  15. ARG PHP_UPSTREAM_CONTAINER=php-fpm
  16. ARG PHP_UPSTREAM_PORT=9000
  17. # Set upstream conf and remove the default conf
  18. RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf \
  19. && rm /etc/nginx/conf.d/default.conf
  20. ADD ./startup.sh /opt/startup.sh
  21. RUN sed -i 's/\r//g' /opt/startup.sh
  22. CMD ["/bin/bash", "/opt/startup.sh"]
  23. EXPOSE 80 443