1
0

Added Docker

This commit is contained in:
2025-04-01 16:25:40 +02:00
parent 97377d2c11
commit 3376284ac4
6 changed files with 44 additions and 1 deletions

3
.dockerignore Normal file
View File

@@ -0,0 +1,3 @@
docker-compose.yml
Dockerfile
data

1
.gitignore vendored
View File

@@ -21,3 +21,4 @@ yarn-error.log
/.nova /.nova
/.vscode /.vscode
/.zed /.zed
data

17
Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM composer:latest AS build
WORKDIR /var/www/freezer-web-app
COPY . .
RUN ["composer", "install", "--optimize-autoloader", "--no-dev"]
RUN ["php", "artisan", "optimize"]
FROM php:8.4-apache
WORKDIR /var/www/freezer-web-app
ENV APACHE_DOCUMENT_ROOT=/var/www/freezer-web-app/public
COPY --from=build /var/www/freezer-web-app .
COPY ./configuring.sh /configuring.sh
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN ["a2enmod", "rewrite"]
RUN ["chown", "-R", "www-data", "."]
RUN ["chmod", "+x", "/configuring.sh"]

12
configuring.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
if [ $FIRSTRUN == "true" ]; then
echo "FIRSTRUN true configuring db and permissions"
cd /var/www/freezer-web-app
chown -R www-data ./database
php artisan migrate --force
apache2ctl -D FOREGROUND
else
echo "FIRSTRUN false configuration already done"
apache2ctl -D FOREGROUND
fi

10
docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
services:
freezer:
image: nastroa/freezer-app
environment:
- FIRSTRUN=false
volumes:
- ./data/database/database.sqlite:/var/www/freezer-web-app/database/database.sqlite:rw
ports:
- "8480:80"
entrypoint: ["/configuring.sh"]

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
@vite('resources/css/app.css') @vite('resources/css/app.css')
<title>Document</title> <title>Freezer</title>
</head> </head>
<body> <body>
<div class="p-4"> <div class="p-4">