Skip to content

Instantly share code, notes, and snippets.

@TilBlechschmidt
Created April 17, 2023 14:56
Show Gist options
  • Save TilBlechschmidt/3ae057ca7f604fc22fe22450f6dba994 to your computer and use it in GitHub Desktop.
Save TilBlechschmidt/3ae057ca7f604fc22fe22450f6dba994 to your computer and use it in GitHub Desktop.
DVWA Dockerfile
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt -y install software-properties-common
RUN add-apt-repository ppa:ondrej/php
RUN apt update && apt -y install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-gd unzip wget mysql-server
RUN wget https://github.com/ethicalhack3r/DVWA/archive/master.zip -O master.zip
RUN unzip master.zip -d /var/www/html && mv /var/www/html/DVWA-master /var/www/html/dvwa
WORKDIR /var/www/html/dvwa
RUN sed -i "s/allow_url_include = Off/allow_url_include = On/g" /etc/php/5.6/apache2/php.ini
RUN cp config/config.inc.php.dist config/config.inc.php && \
chgrp www-data config && \
chmod g+w config && \
chgrp www-data hackable/uploads && \
chmod g+w hackable/uploads
# && \
# chgrp www-data external/phpids/0.6/lib/IDS/tmp/phpids_log.txt && \
# chmod g+w external/phpids/0.6/lib/IDS/tmp/phpids_log.txt
RUN mkdir /var/run/mysqld && \
chmod 777 /var/run/mysqld
COPY entrypoint.sh /
#!/bin/sh
/usr/sbin/apachectl start
/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
mysql -e "CREATE USER 'dvwa'@'localhost' IDENTIFIED BY 'p@ssw0rd';"
mysql -e "GRANT ALL ON *.* to 'dvwa'@'localhost';"
mysql -e "FLUSH PRIVILEGES;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment