This commit is contained in:
parent
e9a277968f
commit
606ad60c9a
72
Dockerfile
72
Dockerfile
@ -1,44 +1,36 @@
|
|||||||
FROM php:8.3-fpm
|
# Define the base image
|
||||||
|
FROM teguh02/laravel-filament:latest
|
||||||
# Install system dependencies & PHP extensions
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
libzip-dev \
|
|
||||||
unzip \
|
|
||||||
git \
|
|
||||||
libpq-dev \
|
|
||||||
libicu-dev \
|
|
||||||
zip \
|
|
||||||
curl \
|
|
||||||
&& docker-php-ext-install \
|
|
||||||
intl \
|
|
||||||
zip \
|
|
||||||
pdo_pgsql \
|
|
||||||
bcmath
|
|
||||||
|
|
||||||
# Install Composer
|
|
||||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /var/www
|
|
||||||
|
|
||||||
# Copy source
|
|
||||||
COPY . .
|
|
||||||
COPY .env.example .env
|
|
||||||
|
|
||||||
# Set www-data user permission before running composer/install artisan
|
|
||||||
RUN chown -R www-data:www-data /var/www
|
|
||||||
|
|
||||||
USER www-data
|
|
||||||
|
|
||||||
# Install dependencies & generate app key as www-data user
|
|
||||||
RUN composer install --no-interaction --prefer-dist --optimize-autoloader \
|
|
||||||
&& php artisan key:generate
|
|
||||||
|
|
||||||
|
# Set user to root
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# Set permissions again just in case
|
# Change the working directory
|
||||||
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache \
|
WORKDIR /var/www
|
||||||
&& chmod -R 775 /var/www/storage /var/www/bootstrap/cache
|
|
||||||
|
|
||||||
EXPOSE 9000
|
# Remove the all files in the /var/www/html directory
|
||||||
CMD ["php-fpm"]
|
RUN rm -rf /var/www/html/*
|
||||||
|
|
||||||
|
# Copy laravel public directory to the /var/www/html directory
|
||||||
|
COPY ./public /var/www/html
|
||||||
|
|
||||||
|
# Copy the project files to the /var/www directory
|
||||||
|
COPY . /var/www
|
||||||
|
|
||||||
|
# Install the project dependencies
|
||||||
|
RUN composer install
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Build the vite
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Change the directory permission
|
||||||
|
RUN chmod -R 777 /var/www
|
||||||
|
|
||||||
|
# If you want to change the timezone of the container to UTC
|
||||||
|
# RUN sed -i 's/;date.timezone =/date.timezone = UTC/g' /etc/php/8.3/fpm/php.ini
|
||||||
|
# RUN sed -i 's/;date.timezone =/date.timezone = UTC/g' /etc/php/8.3/cli/php.ini
|
||||||
|
|
||||||
|
# If you want to display the error message
|
||||||
|
RUN sed -i 's/display_errors = Off/display_errors = On/g' /etc/php/8.3/fpm/php.ini
|
||||||
|
RUN sed -i 's/display_errors = Off/display_errors = On/g' /etc/php/8.3/cli/php.ini
|
||||||
|
RUN sed -i 's/error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT/error_reporting = E_ALL/g' /etc/php/8.3/fpm/php.ini
|
||||||
|
|||||||
@ -1,40 +1,24 @@
|
|||||||
version: "3"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
sistem-akademik-dev:
|
sistem-akademik-dev:
|
||||||
build: .
|
|
||||||
container_name: sistem-akademik-dev
|
container_name: sistem-akademik-dev
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./public:/var/www/html
|
||||||
- .:/var/www
|
- .:/var/www
|
||||||
- ./storage:/var/www/storage
|
|
||||||
working_dir: /var/www
|
|
||||||
expose:
|
|
||||||
- 9000
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
APP_ENV: production
|
|
||||||
APP_DEBUG: false
|
|
||||||
APP_KEY: base64:Wz4daUZXYysRm1vUWBWTjQ5v0JFWBsQ2wPw2tHRALgY=
|
|
||||||
DB_CONNECTION: pgsql
|
|
||||||
DB_HOST: appstaging.my.id
|
|
||||||
DB_PORT: 5432
|
|
||||||
DB_DATABASE: SISKA_2025
|
|
||||||
DB_USERNAME: root
|
|
||||||
DB_PASSWORD: postroot123
|
|
||||||
networks:
|
|
||||||
- traefik_default
|
|
||||||
|
|
||||||
web:
|
|
||||||
image: nginx:alpine
|
|
||||||
container_name: sistem-akademik-dev-web
|
|
||||||
volumes:
|
|
||||||
- .:/var/www
|
|
||||||
- ./nginx:/etc/nginx/conf.d
|
|
||||||
ports:
|
ports:
|
||||||
- 8282:80
|
- 7271:80
|
||||||
depends_on:
|
restart: unless-stopped
|
||||||
- sistem-akademik-dev
|
extra_hosts:
|
||||||
restart: always
|
- "host.docker.internal:host-gateway"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost/up"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.web-http.entrypoints=web"
|
- "traefik.http.routers.web-http.entrypoints=web"
|
||||||
@ -45,7 +29,7 @@ services:
|
|||||||
- "traefik.http.routers.web.rule=Host(`siska.appstaging.my.id`)"
|
- "traefik.http.routers.web.rule=Host(`siska.appstaging.my.id`)"
|
||||||
- 'traefik.http.routers.web.tls=true'
|
- 'traefik.http.routers.web.tls=true'
|
||||||
networks:
|
networks:
|
||||||
- traefik_default
|
- traefik_default
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
traefik_default:
|
traefik_default:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user