Add volumes with correct permissions
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Philipp Lang 2023-07-21 11:28:45 +02:00
parent 62d6730071
commit f8d6cf6a92
7 changed files with 87 additions and 6 deletions

View File

@ -10,4 +10,4 @@ function wait_for_db {
done done
} }
php artisan horizon su www-data -c 'php artisan horizon'

View File

@ -15,6 +15,7 @@ WORKDIR /app
COPY --from=node /app /app COPY --from=node /app /app
COPY --from=composer /app/public/vendor /app/public/vendor COPY --from=composer /app/public/vendor /app/public/vendor
COPY ./.docker/nginx/nginx.conf /etc/nginx/nginx.conf COPY ./.docker/nginx/nginx.conf /etc/nginx/nginx.conf
RUN cd public && ln -s ../storage/app/public ./storage
EXPOSE 80 EXPOSE 80
VOLUME ["/app/storage/app"] VOLUME ["/app/storage/app"]

View File

@ -22,4 +22,9 @@ wait_for_db
php -r '$connection = new PDO("mysql:host='$DB_HOST';dbname='$DB_DATABASE'", "'$DB_USERNAME'", "'$DB_PASSWORD'"); $connection->query("DESCRIBE migrations");' > /dev/null || php artisan migrate --seed --force php -r '$connection = new PDO("mysql:host='$DB_HOST';dbname='$DB_DATABASE'", "'$DB_USERNAME'", "'$DB_PASSWORD'"); $connection->query("DESCRIBE migrations");' > /dev/null || php artisan migrate --seed --force
php artisan migrate --force php artisan migrate --force
mkdir /app/packages/laravel-nami/.cookies || true
mkdir /app/storage/app || true
chown -R www-data:www-data /app/packages/laravel-nami/.cookies
chown -R www-data:www-data /app/storage/app
php-fpm -F -R -O php-fpm -F -R -O

View File

@ -19,6 +19,11 @@ COPY --chown=www-data:www-data . /app
COPY --chown=www-data:www-data --from=node /app/public /app/public COPY --chown=www-data:www-data --from=node /app/public /app/public
COPY --chown=www-data:www-data --from=composer /app/vendor /app/vendor COPY --chown=www-data:www-data --from=composer /app/vendor /app/vendor
USER www-data
RUN php artisan telescope:publish
RUN php artisan horizon:publish
USER root
COPY ./.docker/php-entrypoint /bin/php-entrypoint COPY ./.docker/php-entrypoint /bin/php-entrypoint
COPY ./.docker/horizon-entrypoint /bin/horizon-entrypoint COPY ./.docker/horizon-entrypoint /bin/horizon-entrypoint

View File

@ -7,3 +7,4 @@ bootstrap/cache/services.php
bootstrap/cache/packages.php bootstrap/cache/packages.php
bootstrap/cache/routes.php bootstrap/cache/routes.php
packages/laravel-nami/.cookies packages/laravel-nami/.cookies
app/storage/app

63
docker-compose.prod.yml Normal file
View File

@ -0,0 +1,63 @@
version: '3'
services:
webservice:
image: zoomyboy/adrema-webservice:latest
depends_on:
- php
ports:
- '8000:80'
volumes:
- ./data/storage:/app/storage/app
php:
image: zoomyboy/adrema-app:latest
depends_on:
- db
env_file:
- .app.env
environment:
DB_HOST: db
DB_DATABASE: db
DB_USERNAME: db
QUEUE_CONNECTION: redis
XELATEX_BIN: /usr/bin/xelatex
PDFLATEX_BIN: /usr/bin/pdflatex
REDIS_HOST: redis
volumes:
- ./data/storage:/app/storage/app
- ./cookies:/app/packages/laravel-nami/.cookies
horizon:
image: zoomyboy/adrema-app:latest
depends_on:
- db
- php
command: /bin/horizon-entrypoint
env_file:
- .app.env
environment:
DB_HOST: db
DB_DATABASE: db
DB_USERNAME: db
QUEUE_CONNECTION: redis
XELATEX_BIN: /usr/bin/xelatex
PDFLATEX_BIN: /usr/bin/pdflatex
REDIS_HOST: redis
volumes:
- ./data/storage:/app/storage/app
- ./cookies:/app/packages/laravel-nami/.cookies
db:
image: mariadb:10.6.5
env_file:
- .app.env
environment:
MARIADB_RANDOM_ROOT_PASSWORD: yes
MYSQL_DATABASE: db
MYSQL_USER: db
volumes:
- ./data/db:/var/lib/mysql
redis:
image: redis:alpine3.18
container_name: redis

View File

@ -1,16 +1,20 @@
version: '3' version: '3'
services: services:
webservice: webservice:
image: zoomyboy/adrema-webservice:latest build:
context: .
dockerfile: ./.docker/nginx.Dockerfile
depends_on: depends_on:
- php - php
ports: ports:
- '8000:80' - '8000:80'
volumes: volumes:
- ./storage:/app/storage/app - ./data/storage:/app/storage/app
php: php:
image: zoomyboy/adrema-app:latest build:
context: .
dockerfile: ./.docker/php.Dockerfile
depends_on: depends_on:
- db - db
env_file: env_file:
@ -24,11 +28,13 @@ services:
PDFLATEX_BIN: /usr/bin/pdflatex PDFLATEX_BIN: /usr/bin/pdflatex
REDIS_HOST: redis REDIS_HOST: redis
volumes: volumes:
- ./storage:/app/storage/app - ./data/storage:/app/storage/app
- ./cookies:/app/packages/laravel-nami/.cookies - ./cookies:/app/packages/laravel-nami/.cookies
horizon: horizon:
image: zoomyboy/adrema-app:latest build:
context: .
dockerfile: ./.docker/php.Dockerfile
depends_on: depends_on:
- db - db
- php - php