-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile-nginx
More file actions
28 lines (26 loc) · 883 Bytes
/
Dockerfile-nginx
File metadata and controls
28 lines (26 loc) · 883 Bytes
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
# https://codingwithmanny.medium.com/configure-self-signed-ssl-for-nginx-docker-from-a-scratch-7c2bcd5478c6
FROM alpine
ENV APP_DIR /var/www/localhost/htdocs
ENV NGINX_CONFIG nginx-alpine-ssl
COPY . ${APP_DIR}
# RUN
RUN apk add nginx; \
mkdir /run/nginx/; \
rm -rf ${APP_DIR}/index.html; \
mv ${APP_DIR}/index-demo.html ${APP_DIR}/index.html;
# CONFIGUTATIONS
# nginx configuration
ADD ${NGINX_CONFIG}/config/default.conf /etc/nginx/conf.d/default.conf
# keys and certs
ADD ${NGINX_CONFIG}/config/*.key /etc/ssl/private/
ADD ${NGINX_CONFIG}/config/*.crt /etc/ssl/certs/
WORKDIR $APP_DIR
# ENTRYPOINT
COPY ${NGINX_CONFIG}/config/entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/bin/sh", "/usr/local/bin/entrypoint.sh"]
# EXPOSE PORTS
EXPOSE 80
EXPOSE 443
# RUN COMMAND
CMD ["/bin/sh", "-c", "nginx -g 'daemon off;'; nginx -s reload;"]