Removed root usage in container
continuous-integration/drone the build failed
Details
continuous-integration/drone the build failed
Details
parent
a2aaaa81ec
commit
6752b55a6b
|
@ -32,15 +32,19 @@ RUN hugo --minify
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
ARG THTTPD_VER
|
ARG THTTPD_VER
|
||||||
|
|
||||||
# Install dumb-init
|
# Install dumb-init & create a non-root user
|
||||||
RUN apk update && \
|
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 over binary & static files
|
||||||
COPY --from=builder /usr/src/thttpd-$THTTPD_VER/thttpd /usr/local/bin/thttpd
|
COPY --from=builder /usr/src/thttpd-$THTTPD_VER/thttpd /usr/local/bin/thttpd
|
||||||
COPY --from=builder /usr/src/app/public /var/www/html
|
COPY --from=builder /usr/src/app/public /var/www/html
|
||||||
COPY thttpd.conf /etc/thttpd.conf
|
COPY thttpd.conf /etc/thttpd.conf
|
||||||
|
|
||||||
|
# A static file server doesn't need root
|
||||||
|
USER www-data:www-data
|
||||||
|
|
||||||
ENTRYPOINT [ "dumb-init", "--" ]
|
ENTRYPOINT [ "dumb-init", "--" ]
|
||||||
CMD [ "/usr/local/bin/thttpd", "-D", "-C", "/etc/thttpd.conf" ]
|
CMD [ "/usr/local/bin/thttpd", "-D", "-C", "/etc/thttpd.conf" ]
|
||||||
|
|
Reference in New Issue