This commit is contained in:
parent
f14285bdd6
commit
e7292513bf
34
Dockerfile
34
Dockerfile
@ -1,5 +1,4 @@
|
||||
FROM --platform=linux/arm64 php:8.3-cli
|
||||
|
||||
FROM php:8.3-fpm
|
||||
|
||||
# Install system dependencies & PHP extensions
|
||||
RUN apt-get update && apt-get install -y \
|
||||
@ -22,30 +21,23 @@ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
# Set working directory
|
||||
WORKDIR /var/www
|
||||
|
||||
# Copy source code
|
||||
# Copy project files
|
||||
COPY . .
|
||||
COPY .env.example .env
|
||||
|
||||
# Set permissions for Laravel writable directories
|
||||
RUN mkdir -p storage bootstrap/cache \
|
||||
&& chown -R www-data:www-data /var/www \
|
||||
&& chmod -R ug+rwx storage bootstrap/cache
|
||||
|
||||
# Use non-root user for installing dependencies
|
||||
USER www-data
|
||||
|
||||
# Install PHP dependencies
|
||||
# Install Laravel dependencies
|
||||
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||
|
||||
# Back to root to ensure runtime permissions
|
||||
USER root
|
||||
# Create storage folders (in case they don't exist)
|
||||
RUN mkdir -p storage/framework/{cache,sessions,views} bootstrap/cache
|
||||
|
||||
# Re-apply permissions to writable folders
|
||||
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache \
|
||||
&& chmod -R 775 /var/www/storage /var/www/bootstrap/cache
|
||||
# Generate Laravel app key
|
||||
RUN php artisan key:generate
|
||||
|
||||
# Expose Laravel development server port
|
||||
EXPOSE 8000
|
||||
# Set permissions
|
||||
RUN chown -R www-data:www-data /var/www \
|
||||
&& chmod -R 775 storage bootstrap/cache \
|
||||
&& chown -R www-data:www-data storage bootstrap/cache
|
||||
|
||||
# Run with artisan serve instead of php-fpm
|
||||
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
|
||||
EXPOSE 9000
|
||||
CMD ["php-fpm"]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
version: "3.8"
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
sistem-akademik-dev:
|
||||
@ -6,9 +6,10 @@ services:
|
||||
container_name: sistem-akademik-dev
|
||||
volumes:
|
||||
- .:/var/www
|
||||
- ./storage:/var/www/storage
|
||||
working_dir: /var/www
|
||||
ports:
|
||||
- "8000:8000" # Laravel Artisan Serve port
|
||||
expose:
|
||||
- 9000
|
||||
restart: always
|
||||
environment:
|
||||
APP_ENV: production
|
||||
@ -20,17 +21,27 @@ services:
|
||||
DB_DATABASE: SISKA_2025
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: postroot123
|
||||
|
||||
web:
|
||||
image: nginx:alpine
|
||||
container_name: sistem-akademik-dev-web
|
||||
volumes:
|
||||
- .:/var/www
|
||||
- ./nginx/conf.d:/etc/nginx/conf.d
|
||||
ports:
|
||||
- 8080:80
|
||||
depends_on:
|
||||
- app
|
||||
restart: always
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.sistem-akademik-dev-http.entrypoints=web"
|
||||
- "traefik.http.routers.sistem-akademik-dev-http.rule=Host(`siska.appstaging.my.id`)"
|
||||
- "traefik.http.routers.sistem-akademik-dev-http.middlewares=redirect-to-https"
|
||||
- "traefik.http.routers.sistem-akademik-dev.rule=Host(`siska.appstaging.my.id`)"
|
||||
- "traefik.http.services.sistem-akademik-dev.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.sistem-akademik-dev.entrypoints=websecure"
|
||||
- "traefik.http.routers.sistem-akademik-dev.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.sistem-akademik-dev.rule=Host(`siska.appstaging.my.id`)"
|
||||
- "traefik.http.routers.sistem-akademik-dev.tls=true"
|
||||
networks:
|
||||
- traefik_default
|
||||
- traefik_default
|
||||
|
||||
networks:
|
||||
traefik_default:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user