Add entrypoint script and update Dockerfile for proper initialization; modify Traefik labels for production environment
All checks were successful
Deploy Production (admin.merchbay.app) / deploy (push) Successful in 2m42s
All checks were successful
Deploy Production (admin.merchbay.app) / deploy (push) Successful in 2m42s
This commit is contained in:
@@ -32,6 +32,10 @@ WORKDIR /var/www/html
|
||||
# Copy existing application directory contents
|
||||
COPY . /var/www/html
|
||||
|
||||
# Copy and set permissions for entrypoint script
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
# Create storage directories and set permissions
|
||||
RUN mkdir -p storage/framework/views \
|
||||
storage/framework/cache \
|
||||
@@ -67,5 +71,8 @@ RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Set entrypoint
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
# Start Apache
|
||||
CMD ["apache2-foreground"]
|
||||
|
||||
@@ -21,15 +21,15 @@ services:
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# Production environment (merchbay.app)
|
||||
- "traefik.http.routers.merchbay-admin-dev.rule=Host(`merchbay.app`)"
|
||||
- "traefik.http.routers.merchbay-admin-dev.entrypoints=websecure"
|
||||
- "traefik.http.routers.merchbay-admin-dev.tls=true"
|
||||
- "traefik.http.routers.merchbay-admin-dev.tls.certresolver=le"
|
||||
- "traefik.http.services.merchbay-admin-dev.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.merchbay-admin-prod.rule=Host(`merchbay.app`)"
|
||||
- "traefik.http.routers.merchbay-admin-prod.entrypoints=websecure"
|
||||
- "traefik.http.routers.merchbay-admin-prod.tls=true"
|
||||
- "traefik.http.routers.merchbay-admin-prod.tls.certresolver=le"
|
||||
- "traefik.http.services.merchbay-admin-prod.loadbalancer.server.port=80"
|
||||
# HTTP to HTTPS redirect
|
||||
- "traefik.http.routers.merchbay-admin-dev-http.rule=Host(`merchbay.app`)"
|
||||
- "traefik.http.routers.merchbay-admin-dev-http.entrypoints=web"
|
||||
- "traefik.http.routers.merchbay-admin-dev-http.middlewares=https-redirect"
|
||||
- "traefik.http.routers.merchbay-admin-prod-http.rule=Host(`merchbay.app`)"
|
||||
- "traefik.http.routers.merchbay-admin-prod-http.entrypoints=web"
|
||||
- "traefik.http.routers.merchbay-admin-prod-http.middlewares=https-redirect"
|
||||
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
|
||||
networks:
|
||||
- traefik-public
|
||||
|
||||
18
docker-entrypoint.sh
Normal file
18
docker-entrypoint.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Create storage directory structure if it doesn't exist
|
||||
mkdir -p storage/framework/views
|
||||
mkdir -p storage/framework/cache
|
||||
mkdir -p storage/framework/sessions
|
||||
mkdir -p storage/logs
|
||||
mkdir -p storage/app/public
|
||||
mkdir -p bootstrap/cache
|
||||
mkdir -p public/uploads
|
||||
|
||||
# Set proper permissions
|
||||
chown -R www-data:www-data storage bootstrap/cache public/uploads
|
||||
chmod -R 775 storage bootstrap/cache public/uploads
|
||||
|
||||
# Execute the main command
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user