Last active
September 30, 2022 13:24
-
-
Save elvinlari/28bd0694ab27c4bb1892ea95ca4a0b95 to your computer and use it in GitHub Desktop.
Nginx Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nginx:stable-alpine | |
# environment arguments | |
ARG UID | |
ARG GID | |
ARG USER | |
ENV UID=${UID} | |
ENV GID=${GID} | |
ENV USER=${USER} | |
# Dialout group in alpine linux conflicts with MacOS staff group's gid, whis is 20. So we remove it. | |
RUN delgroup dialout | |
# Creating user and group | |
RUN addgroup -g ${GID} --system ${USER} | |
RUN adduser -G ${USER} --system -D -s /bin/sh -u ${UID} ${USER} | |
# Modify nginx configuration to use the new user's priviledges for starting it. | |
RUN sed -i "s/user nginx/user '${USER}'/g" /etc/nginx/nginx.conf | |
# Copies nginx configurations to override the default. | |
ADD ./nginx/*.conf /etc/nginx/conf.d/ | |
# Make html directory | |
RUN mkdir -p /var/www/html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment