Sign inSign up

madawa/httpd

By madawa

Updated over 2 years ago

This is a simple non-root httpd:alpine docker image which can be use as a web server.

Image
Web servers
0

410

madawa/httpd repository overview

Docker File

FROM httpd:alpine

# Define user and group
ENV APACHE_RUN_USER=app
ENV APACHE_RUN_GROUP=app
ENV PORT=80

# Create a non-root user and group
RUN addgroup -S ${APACHE_RUN_USER} && adduser -S ${APACHE_RUN_USER} -G ${APACHE_RUN_GROUP}

# Add acl package
RUN apk update && apk add acl

# Set working directory
WORKDIR /usr/local/apache2/htdocs/

# Modify httpd.conf to use the non-root user and listen on port 8080
RUN sed -i \
        -e "s/^User daemon/User ${APACHE_RUN_USER}/" \
        -e "s/^Group daemon/Group ${APACHE_RUN_GROUP}/" \
        /usr/local/apache2/conf/httpd.conf

# Change ownership of the website directory
RUN setfacl -R -m u:${APACHE_RUN_USER}:rwx /usr/local/apache2/

# Configure Apache to run with the non-root user
USER ${APACHE_RUN_USER}

# Expose the default Apache port
EXPOSE ${PORT}

# Expose the document root as a volume
VOLUME /usr/local/apache2/htdocs

# Start Apache
CMD ["httpd", "-D", "FOREGROUND"]

Tag summary

Content type

Image

Digest

sha256:13930d4a2

Size

22.6 MB

Last updated

over 2 years ago

docker pull madawa/httpd