Add docker dev

This commit is contained in:
Jorit Tijsen
2024-05-06 13:32:23 +02:00
parent 6220a405a3
commit 684cba6085
6 changed files with 149 additions and 4 deletions

View File

@@ -27,12 +27,11 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
ADD docker/apache.conf /etc/apache2/sites-enabled/000-default.conf ADD docker/apache.conf /etc/apache2/sites-enabled/000-default.conf
WORKDIR /var/www/html WORKDIR /var/www/html
COPY . /var/www/html
RUN mkdir -p storage/framework/{sessions,views,cache,cache/data} && \ RUN mkdir -p storage/framework/{sessions,views,cache,cache/data} && \
chown -R www-data:www-data storage/framework && \ chown -R www-data:www-data storage/framework && \
chmod -R 775 storage chmod -R 775 storage
# RUN php artisan cache:clear && \ # RUN php artisan cache:clear && \
# php artisan config:clear && \ # php artisan config:clear && \
# php artisan view:clear # php artisan view:clear

38
Dockerfile.dev Normal file
View File

@@ -0,0 +1,38 @@
FROM php:8.1-apache
RUN apt-get update \
&& apt-get -y install \
g++ \
libcurl4-gnutls-dev \
libxml2-dev \
libxslt-dev \
libzip-dev \
zlib1g-dev \
msmtp \
unzip \
git \
ssl-cert \
locales \
--no-install-recommends \
&& docker-php-ext-install pdo pdo_mysql mysqli xsl xml zip opcache \
&& a2enmod rewrite ssl proxy proxy_http headers \
&& apt-get purge -y g++ \
&& apt-get autoremove -y \
&& rm -r /var/lib/apt/lists/*
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Update the default apache site with the config we created.
ADD docker/apache.dev.conf /etc/apache2/sites-enabled/000-default.conf
WORKDIR /var/www/html
COPY . /var/www/html
RUN mkdir -p storage/framework/{sessions,views,cache,cache/data} && \
chown -R www-data:www-data storage/framework && \
chmod -R 775 storage
# RUN php artisan cache:clear && \
# php artisan config:clear && \
# php artisan view:clear

24
docker-compose.dev.yml Normal file
View File

@@ -0,0 +1,24 @@
version: '3.8'
services:
web:
build:
context: ./
dockerfile: Dockerfile.dev
ports:
- 8080:80
- 8443:443
volumes:
- .:/var/www/html
- ./srv:/srv
db:
image: mysql:5.5
ports:
- "3306:3306"
expose:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: development-password
MYSQL_DATABASE: forge
MYSQL_USER: forge
MYSQL_PASSWORD: secret

46
docker/apache.dev.conf Normal file
View File

@@ -0,0 +1,46 @@
Header set X-Content-Type-Options: "nosniff"
Header set X-Frame-Options: "sameorigin"
ServerTokens Prod
<VirtualHost *:80>
ServerName localhost
ServerAdmin support@websight.nl
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order deny,allow
Allow from all
</Directory>
ErrorLog /var/log/apache2/vhost-error.log
CustomLog /var/log/apache2/vhost-access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName localhost
ServerAdmin support@websight.nl
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
SSLCompression off
SSLProtocol All -SSLv2 -SSLv3
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
<Directory /var/www/html/>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order deny,allow
Allow from all
</Directory>
ErrorLog /var/log/apache2/ssl-vhost-error.log
CustomLog /var/log/apache2/ssl-vhost-access.log combined
</VirtualHost>
</IfModule>

39
env.example Normal file
View File

@@ -0,0 +1,39 @@
APP_NAME="NH Gooi"
APP_ENV=production
APP_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
APP_DEBUG=false
APP_LOG_LEVEL=error
APP_URL=https://dev.nhgooi.nl
IMAGE_BASE_URL=https://dev.nhgooi.nl
API_URL=https://api.nhgooi.nl/
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=in-v3.mailjet.com
MAIL_PORT=25
MAIL_USERNAME=mailjet_username
MAIL_PASSWORD=mailjet_password
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
DB_CONNECTION=mysql
DB_HOST=nhgooi.nl
DB_PORT=3306
DB_DATABASE=dbname
DB_USERNAME=6fmstats
DB_PASSWORD=dbpass
CACHE_DRIVER=file
QUEUE_DRIVER=sync

View File

@@ -1 +0,0 @@
<?php phpinfo();