Skip to content

Instantly share code, notes, and snippets.

@fabianoflorentino
Created November 30, 2019 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabianoflorentino/a5cf88b57571039e76a733b3d98b2fbf to your computer and use it in GitHub Desktop.
Save fabianoflorentino/a5cf88b57571039e76a733b3d98b2fbf to your computer and use it in GitHub Desktop.
Dockerfile to Apache2 on Alpine Linux
#
# Author: Fabiano Santos Florentino
# Version: 0.0.1
#
FROM alpine
RUN apk update \
&& apk add --no-cache apache2 \
&& adduser apache apache \
&& mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 \
&& chown -R apache:apache /var/lock/apache2 \
&& chown -R apache:apache /var/run/apache2 \
&& chown -R apache:apache /var/log/apache2 \
&& ln -s /dev/stdout /var/log/apache2/access.log \
&& ln -s /dev/stderr /var/log/apache2/error.log
COPY httpd.conf /etc/apache2/
ENV APACHE_LOCK_DIR="/var/lock"
ENV APACHE_PID_FILE="/var/run/apache2.pid"
ENV APACHE_RUN_USER="apache"
ENV APACHE_RUN_GROUP="apache"
ENV APACHE_LOG_DIR="/var/log/apache2"
ENV VIRTUAL_PORT=8080
LABEL description="Webserver"
VOLUME /var/www/html
WORKDIR /var/www/html
USER apache
EXPOSE 8080
ENTRYPOINT [ "/usr/sbin/httpd" ]
CMD [ "-D","FOREGROUND" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment