From 4e82a7c1a11c93466ba68e09fff296abe7c455b5 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Thu, 15 Aug 2024 22:57:01 +0700 Subject: [PATCH] #39 [docker public hub] fix: public nginx image --- .github/workflows/nginx-docker-public.yml | 6 +++--- nginx/Dockerfile | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/nginx-docker-public.yml b/.github/workflows/nginx-docker-public.yml index 87c74ef..b8b8aa2 100644 --- a/.github/workflows/nginx-docker-public.yml +++ b/.github/workflows/nginx-docker-public.yml @@ -80,7 +80,7 @@ jobs: patch=0 minor=$((minor+1)) fi - if [ "$minor" -ge 10]; then + if [ "$minor" -ge 10 ]; then minor=0 major=$((major+1)) fi @@ -116,5 +116,5 @@ jobs: ${{ env.DOCKERHUB_ID }}/${{ env.IMAGE_NAME }}:${{ steps.inc_version.outputs.new_version }} labels: ${{ steps.meta.outputs.labels }} build-args: | - PHP_VERSION=8.3 - PHP_VERSION_SHORT=83 + USER_ID=1000 + GROUP_ID=1000 diff --git a/nginx/Dockerfile b/nginx/Dockerfile index e823e58..d25f06e 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,15 +1,19 @@ -ARG PHP_VERSION=8.3 -ARG PHP_VERSION_SHORT=83 - FROM nginx:1.27.0-alpine LABEL maintainer="Tan Nguyen " LABEL authors="cslant" LABEL description="Nginx image for CSlant development - Using for Blog" +ARG USER_ID=1000 +ARG GROUP_ID=1000 + +## Set Environment +ENV USER_ID=$USER_ID +ENV GROUP_ID=$GROUP_ID + COPY nginx.conf /etc/nginx/ -RUN addgroup -g ${PHP_VERSION_SHORT} www-data && \ - adduser -u ${PHP_VERSION_SHORT} -G www-data -D www-data +RUN addgroup -g ${USER_ID} www-data; \ + adduser -u ${GROUP_ID} -D -S -G www-data www-data; WORKDIR /var/dev