From 2ea5ebfc65aa266dbaa8878a36fa25f170418219 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 25 Oct 2019 22:38:43 +0200 Subject: [PATCH] create.sh: Separate uid and gid arguments --- caddy_docker_custom_user/Dockerfile | 50 ++++++++++++++++++----------- caddy_docker_custom_user/create.sh | 7 ++-- 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/caddy_docker_custom_user/Dockerfile b/caddy_docker_custom_user/Dockerfile index 0587dd4..72213d6 100644 --- a/caddy_docker_custom_user/Dockerfile +++ b/caddy_docker_custom_user/Dockerfile @@ -3,21 +3,21 @@ # FROM abiosoft/caddy:builder as builder -ARG version="1.0.0" -ARG plugins="git,cors,realip,expires,cache" +ARG version="1.0.3" +ARG plugins="git,cors,realip,expires,cache,cloudflare,ovh" -# process wrapper +# Process Wrapper RUN go get -v github.com/abiosoft/parent -RUN VERSION=${version} PLUGINS=${plugins} /bin/sh /usr/bin/builder.sh +RUN VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=false /bin/sh /usr/bin/builder.sh # -# Final stage +# Final Stage # -FROM alpine:3.8 +FROM alpine:3.10 LABEL maintainer "Abiola Ibrahim " -ARG version="1.0.0" +ARG version="1.0.3" LABEL caddy_version="$version" # PHP www-user UID and GID @@ -27,23 +27,38 @@ ARG PGID="1000" # Let's Encrypt Agreement ENV ACME_AGREE="false" -RUN apk add --no-cache openssh-client git tar php7-fpm curl +# Telemetry Stats +ENV ENABLE_TELEMETRY="false" -# essential php libs +RUN apk add --no-cache \ + ca-certificates \ + curl \ + git \ + mailcap \ + openssh-client \ + php7-fpm \ + tar \ + tzdata + +# Essential PHP Extensions RUN apk add --no-cache \ php7-bcmath \ php7-ctype \ php7-curl \ php7-dom \ + php7-exif \ php7-fileinfo \ php7-gd \ php7-iconv \ php7-json \ php7-mbstring \ php7-mysqli \ + php7-opcache \ php7-openssl \ php7-pdo \ php7-pdo_mysql \ + php7-pdo_pgsql \ + php7-pdo_sqlite \ php7-pgsql \ php7-phar \ php7-session \ @@ -55,35 +70,34 @@ RUN apk add --no-cache \ php7-xmlwriter \ php7-zip -# symblink php7 to php +# Symlink php7 to php RUN ln -sf /usr/bin/php7 /usr/bin/php -# symlink php-fpm7 to php-fpm +# Symlink php-fpm7 to php-fpm RUN ln -sf /usr/bin/php-fpm7 /usr/bin/php-fpm -# add a php www-user instead of nobody +# Add a PHP www-user instead of nobody RUN addgroup -g ${PGID} www-user && \ adduser -D -H -u ${PUID} -G www-user www-user && \ sed -i "s|^user = .*|user = www-user|g" /etc/php7/php-fpm.d/www.conf && \ sed -i "s|^group = .*|group = www-user|g" /etc/php7/php-fpm.d/www.conf -# composer +# Composer RUN curl --silent --show-error --fail --location \ --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" \ "https://getcomposer.org/installer" \ | php -- --install-dir=/usr/bin --filename=composer -# allow environment variable access. +# Allow environment variable access RUN echo "clear_env = no" >> /etc/php7/php-fpm.conf -# install caddy +# Install Caddy COPY --from=builder /install/caddy /usr/bin/caddy -# validate install +# Validate install RUN /usr/bin/caddy -version RUN /usr/bin/caddy -plugins - EXPOSE 80 443 2015 VOLUME /root/.caddy /srv WORKDIR /srv @@ -91,7 +105,7 @@ WORKDIR /srv COPY Caddyfile /etc/Caddyfile COPY index.php /srv/index.php -# install process wrapper +# Install Process Wrapper COPY --from=builder /go/bin/parent /bin/parent ENTRYPOINT ["/bin/parent", "caddy"] diff --git a/caddy_docker_custom_user/create.sh b/caddy_docker_custom_user/create.sh index ff48e83..22a05f9 100644 --- a/caddy_docker_custom_user/create.sh +++ b/caddy_docker_custom_user/create.sh @@ -2,8 +2,9 @@ if [ $# -eq 0 ] then - echo "Usage: