Compare commits

...

7 Commits

Author SHA1 Message Date
David Bomba
4431abcb88 Merge pull request #643 from turbo124/debian
Updates for permission handling in the container
2024-11-23 21:00:01 +11:00
David Bomba
d05e55a24e Updates for permission handling in the container 2024-11-23 20:58:56 +11:00
David Bomba
34e5043317 Merge pull request #642 from turbo124/debian
Fixes for tar command flags
2024-11-23 19:14:23 +11:00
David Bomba
6f92d1c155 Fixes for tar command flags 2024-11-23 19:13:59 +11:00
David Bomba
11330003a2 Merge pull request #641 from turbo124/debian
Updates for tar extraction
2024-11-23 19:01:32 +11:00
David Bomba
47b015af7c More explicity unpacking of .tar file 2024-11-23 19:00:45 +11:00
David Bomba
c6648a8511 Updates for tar extraction 2024-11-23 18:48:09 +11:00
2 changed files with 29 additions and 17 deletions

24
debian/Dockerfile vendored
View File

@@ -117,10 +117,19 @@ WORKDIR /var/www/html
RUN set -eux; \ RUN set -eux; \
DOWNLOAD_URL=$(curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \ DOWNLOAD_URL=$(curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \
grep -o '"browser_download_url": "[^"]*invoiceninja.tar"' | cut -d '"' -f 4) && \ grep -o '"browser_download_url": "[^"]*invoiceninja.tar"' | cut -d '"' -f 4) && \
curl -L "$DOWNLOAD_URL" | tar -xzf - -C /var/www/html --overwrite && \ echo "Downloading from: $DOWNLOAD_URL" && \
rm -rf /var/www/html/ui && \ # Download and save the tar
curl -L "$DOWNLOAD_URL" -o /tmp/ninja.tar && \
# Try extraction
cd /var/www/html && \
tar -xf /tmp/ninja.tar && \
# List what was extracted
rm -f /tmp/ninja.tar && \
chown -R www-data:www-data /var/www/html chown -R www-data:www-data /var/www/html
# After setting permissions, switch to www-data for remaining operations
USER www-data
# Install dependencies # Install dependencies
RUN composer install --no-dev --no-scripts --no-autoloader RUN composer install --no-dev --no-scripts --no-autoloader
@@ -131,6 +140,8 @@ RUN composer dump-autoload --optimize \
&& php artisan config:cache \ && php artisan config:cache \
&& php artisan route:cache && php artisan route:cache
USER root
# Setup supervisor # Setup supervisor
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
@@ -151,7 +162,7 @@ RUN mkdir -p \
/var/www/html/storage/framework/sessions \ /var/www/html/storage/framework/sessions \
/var/www/html/storage/framework/views \ /var/www/html/storage/framework/views \
/var/www/html/storage/logs \ /var/www/html/storage/logs \
/var/www/html/public/uploads \ /var/www/html/public/storage \
/var/run \ /var/run \
/var/log/supervisor /var/log/supervisor
@@ -159,16 +170,19 @@ RUN mkdir -p \
RUN chown -R www-data:www-data \ RUN chown -R www-data:www-data \
/var/www/html/storage \ /var/www/html/storage \
/var/www/html/bootstrap/cache \ /var/www/html/bootstrap/cache \
/var/www/html/public/uploads \ /var/www/html/public/storage \
/var/run \ /var/run \
/var/log/supervisor \ /var/log/supervisor \
&& chmod -R 775 \ && chmod -R 775 \
/var/www/html/public/uploads \ /var/www/html/public/storage \
/var/www/html/storage \ /var/www/html/storage \
/var/www/html/bootstrap/cache \ /var/www/html/bootstrap/cache \
/var/run \ /var/run \
/var/log/supervisor /var/log/supervisor
# Switch to www-data for runtime
USER www-data
# Health check # Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD php -v || exit 1 CMD php -v || exit 1

View File

@@ -8,7 +8,7 @@ x-logging: &default-logging
services: services:
app: app:
image: invoiceninja/invoiceninja-debian:5.10.55-d image: invoiceninja/invoiceninja-debian:latest
restart: unless-stopped restart: unless-stopped
env_file: env_file:
- ./.env - ./.env
@@ -16,7 +16,8 @@ services:
- ./.env:/var/www/html/.env - ./.env:/var/www/html/.env
- app_storage:/var/www/html/storage - app_storage:/var/www/html/storage
- app_cache:/var/www/html/bootstrap/cache - app_cache:/var/www/html/bootstrap/cache
- public_files:/var/www/html/public - public_storage:/var/www/html/public/storage
user: www-data:www-data
networks: networks:
- app-network - app-network
@@ -35,14 +36,13 @@ services:
image: nginx:alpine image: nginx:alpine
restart: unless-stopped restart: unless-stopped
ports: ports:
- "8013:80" - "80:80"
volumes: volumes:
- ./nginx/conf.d:/etc/nginx/conf.d:ro - ./nginx/conf.d:/etc/nginx/conf.d:ro
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- type: volume volumes_from:
source: public_files - app
target: /var/www/html/public
read_only: true
networks: networks:
- app-network - app-network
depends_on: depends_on:
@@ -103,13 +103,11 @@ networks:
volumes: volumes:
app_storage: app_storage:
driver: local driver: local
app_public:
driver: local
app_cache: app_cache:
driver: local driver: local
public_storage:
driver: local # Persistent storage for user files
mysql_data: mysql_data:
driver: local driver: local
redis_data: redis_data:
driver: local driver: local
public_files:
driver: local