Removed root usage in container
continuous-integration/drone the build failed Details

master
Jef Roosens 2021-07-19 19:00:07 +02:00
parent a2aaaa81ec
commit 6752b55a6b
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
1 changed files with 6 additions and 2 deletions

View File

@ -32,15 +32,19 @@ RUN hugo --minify
FROM alpine:latest
ARG THTTPD_VER
# Install dumb-init
# Install dumb-init & create a non-root user
RUN apk update && \
apk add --no-cache dumb-init
apk add --no-cache dumb-init && \
addgroup -g 82 -S www-data && \
adduser -u 82 -D -S -G www-data www-data
# Copy over binary & static files
COPY --from=builder /usr/src/thttpd-$THTTPD_VER/thttpd /usr/local/bin/thttpd
COPY --from=builder /usr/src/app/public /var/www/html
COPY thttpd.conf /etc/thttpd.conf
# A static file server doesn't need root
USER www-data:www-data
ENTRYPOINT [ "dumb-init", "--" ]
CMD [ "/usr/local/bin/thttpd", "-D", "-C", "/etc/thttpd.conf" ]