Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions apps/platform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ FROM alpine
RUN apk update
RUN apk add --upgrade nginx brotli nginx-mod-http-brotli

RUN addgroup -g 1001 -S nginxgroup && \
adduser -u 1001 -D -S -G nginxgroup nginxuser
ARG USER_ID=10001
ARG GROUP_ID=10001
ARG USER_NAME=nginxuser

RUN addgroup -g ${GROUP_ID} -S nginxgroup && \
adduser -u ${USER_ID} -D -S -G nginxgroup ${USER_NAME}

# copy assets, config and entrypoint
COPY ./bundle-platform /usr/share/nginx/html
Expand All @@ -15,13 +19,13 @@ RUN chmod +x /entrypoint.sh

# create necessary nginx folders and set permissions
RUN mkdir -p /var/run/nginx /var/log/nginx /etc/nginx /usr/share/nginx/html
RUN chown -R nginxuser:nginxgroup /run /var/run/nginx /var/log/nginx /var/lib/nginx /etc/nginx /usr/share/nginx/html
RUN chown -R ${USER_NAME}:nginxgroup /run /var/run/nginx /var/log/nginx /var/lib/nginx /etc/nginx /usr/share/nginx/html

# adjust nginx config to use correct pid file location and remove user directive
RUN sed -i 's/\/var\/run\/nginx.pid/\/var\/run\/nginx\/nginx.pid/g' /etc/nginx/nginx.conf
RUN sed -i '/^user/d' /etc/nginx/nginx.conf

USER nginxuser
USER ${USER_NAME}

# run nginx
ENTRYPOINT [ "/entrypoint.sh" ]