-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-1.17-alpine
54 lines (46 loc) · 2.23 KB
/
Dockerfile-1.17-alpine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM nginx:1.17-alpine
# Installation
RUN apk update && apk add --no-cache bash gettext shadow && \
mv /usr/local/bin/envsubst /bin/ && \
apk del gettext && \
find /var/cache /var/log -type f -delete
# Prepare env and change user
RUN mkdir -p /var/www /var/log/nginx && \
groupdel www-data && \
groupmod -g 101 -n www-data nginx && \
usermod -g 101 -u 100 -l www-data -d /var/www nginx && \
mv /usr/share/nginx/html/* /var/www/ && \
chown -R www-data:www-data /var/www && \
rm -f /etc/nginx/conf.d/default.conf && \
# make a few replacement
sed -i 's/^user .*nginx;/user www-data;/g' /etc/nginx/nginx.conf && \
sed -i 's/^[ \t]*access_log.*;$/ access_log \/dev\/stdout main;/g' /etc/nginx/nginx.conf && \
sed -i 's/^error_log.*;$/error_log stderr info;/g' /etc/nginx/nginx.conf
COPY files/conf/default /etc/nginx/conf.d/default.conf.tpl
COPY files/alpine/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENV NGINX_UID 100
ENV NGINX_GID 101
ENV NGINX_DOCUMENT_ROOT /var/www
ENV PHP_HOST php
ENV PHP_PORT 9000
ENV FASTCGI_READ_TIMEOUT 20s
ENV FASTCGI_SEND_TIMEOUT 20s
EXPOSE 80
VOLUME /var/www
# At the end as it changes everytime ;)
ARG BUILD_DATE
ARG DOCKER_TAG
ARG VCS_REF
LABEL maintainer="Emmanuel Dyan <emmanueldyan@gmail.com>" \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.name=${DOCKER_TAG} \
org.label-schema.description="Docker Nginx Image based on Debian or Alpine. Made to work with php-fpm." \
org.label-schema.url="https://cloud.docker.com/u/edyan/repository/docker/edyan/nginx" \
org.label-schema.vcs-url="https://github.com/edyan/docker-nginx" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.schema-version="1.0" \
org.label-schema.vendor="edyan" \
org.label-schema.docker.cmd="docker run -d --rm ${DOCKER_TAG}"
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]