diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ceb10d1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM php:8.2-apache + +RUN apt-get -y update && apt-get -y install zlib1g-dev libpng-dev +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ + +RUN chmod +x /usr/local/bin/install-php-extensions && \ + install-php-extensions gd mysqli + +# Cleanup +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* + +ENV APACHE_DOCUMENT_ROOT /var/www +ENV APACHE_RUN_USER www-data + +RUN sed -ri -e 's!/var/www/html!/var/www!g' /etc/apache2/sites-available/*.conf +RUN sed -ri -e 's!/var/www/!/var/www!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf +RUN sed -ri -e 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf + +RUN a2enmod rewrite + +ARG UNAME=www-data +ARG UGROUP=www-data +ARG UID=1000 +ARG GID=1000 + +RUN usermod --uid $UID $UNAME +RUN groupmod --gid $GID $UGROUP + +WORKDIR ${APACHE_DOCUMENT_ROOT} + +COPY . ${APACHE_DOCUMENT_ROOT} + +VOLUME ${APACHE_DOCUMENT_ROOT} diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..4b214a2 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,38 @@ +version: '3' + +services: + app: + build: + context: . + dockerfile: Dockerfile + container_name: joerg-app + ports: + - '80:80' + volumes: + - ./:/var/www + links: + - db + networks: + - joerg + restart: unless-stopped + working_dir: /var/www + + db: + image: mysql:8 + container_name: joerg-db + restart: unless-stopped + volumes: + - mysql:/var/lib/mysql + networks: + - joerg + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_PASSWORD: lmaa,dw. + MYSQL_USER: web104 + MYSQL_DATABASE: usr_web104_1 + +networks: + joerg: + +volumes: + mysql: \ No newline at end of file