This commit is contained in:
Alfin Afif 2025-08-22 11:04:15 +07:00
parent 15b1e8af19
commit b811249815
7 changed files with 211 additions and 411 deletions

View File

@ -1,36 +0,0 @@
stages:
- build
- deploy
variables:
IMAGE_NAME: purwakarta-diskominfo-simedkom
IMAGE_TAG: v1.0.1
CONTAINER_NAME: purwakarta-diskominfo-simedkom
DOCKER_REGISTRY: registry.mango.local
DOCKER_IMAGE_FULL_PATH: $DOCKER_REGISTRY/pratama/$IMAGE_NAME:$IMAGE_TAG
DOCKER_DRIVER: overlay2
build:
stage: build
image: docker:latest
tags:
- docker
services:
- docker:dind
script:
# - docker login -u $DOCKER_REGISTRY_USER -p $DOCKER_REGISTRY_PASSWORD $DOCKER_REGISTRY
- docker build -t $IMAGE_NAME:$IMAGE_TAG .
- docker tag $IMAGE_NAME:$IMAGE_TAG $DOCKER_IMAGE_FULL_PATH
- docker push $DOCKER_IMAGE_FULL_PATH
deploy:
stage: deploy
image: docker:latest
tags:
- docker
services:
- docker:dind
script:
- docker compose down || true
- docker compose build
- docker compose up -d --build

View File

@ -1,34 +0,0 @@
FROM dunglas/frankenphp:1.1-php8.2
ENV SERVER_NAME=:80
WORKDIR /app
# Install extension yang dibutuhkan Laravel
RUN apt-get update && apt-get install -y \
git \
unzip \
zip \
curl \
libzip-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
pkg-config \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install zip pdo pdo_mysql gd bcmath \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install composer
RUN curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer
COPY . /app
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -126,7 +126,7 @@
// } // }
// }else if(env('FILESYSTEM_DISK') === 'local'){ // }else if(env('FILESYSTEM_DISK') === 'local'){
if (! function_exists('store_file')) { if (! function_exists('store_file')) {
function store_file($file = null, $path, $disk = 'public') function store_file($file = null, $path = null, $disk = 'public')
{ {
if (filled($file) && $file && $file instanceof \Illuminate\Http\UploadedFile) { if (filled($file) && $file && $file instanceof \Illuminate\Http\UploadedFile) {
$randomFilename = Str::random(35) . time() . '.' . $file->getClientOriginalExtension(); $randomFilename = Str::random(35) . time() . '.' . $file->getClientOriginalExtension();
@ -198,7 +198,8 @@ function is_file_exists($path)
} }
if (!function_exists('get_role_name')) { if (!function_exists('get_role_name')) {
function get_role_name($role = null) { function get_role_name($role = null)
{
if ($role === null) { if ($role === null) {
$role = Auth::user()->role_id; $role = Auth::user()->role_id;
@ -222,7 +223,8 @@ function get_role_name($role = null) {
} }
if (!function_exists('shorten_text')) { if (!function_exists('shorten_text')) {
function shorten_text($text, $maxLength = 100) { function shorten_text($text, $maxLength = 100)
{
if (strlen($text) > $maxLength) { if (strlen($text) > $maxLength) {
return substr($text, 0, $maxLength) . '...'; return substr($text, 0, $maxLength) . '...';
} }
@ -232,7 +234,8 @@ function shorten_text($text, $maxLength = 100) {
} }
if (! function_exists('is_role')) { if (! function_exists('is_role')) {
function is_role($roles) { function is_role($roles)
{
if (Auth::check()) { if (Auth::check()) {
return in_array(Auth::user()->role_id, (array) $roles) || Auth::user()->role_id === '4'; return in_array(Auth::user()->role_id, (array) $roles) || Auth::user()->role_id === '4';
} }
@ -299,7 +302,8 @@ function get_edit_status($status)
} }
if (! function_exists('get_cooperation_notif')) { if (! function_exists('get_cooperation_notif')) {
function get_cooperation_notif() { function get_cooperation_notif()
{
$user = User::findOrFail(Auth::id()); $user = User::findOrFail(Auth::id());
if ($user->role_id === 3) { if ($user->role_id === 3) {
$mediaId = $user->company->media->id; $mediaId = $user->company->media->id;
@ -309,7 +313,6 @@ function get_cooperation_notif() {
->where('start_date', '<=', Carbon::now()->locale('id')->toDateString()) ->where('start_date', '<=', Carbon::now()->locale('id')->toDateString())
->where('end_date', '>=', Carbon::now()->locale('id')->toDateString()) ->where('end_date', '>=', Carbon::now()->locale('id')->toDateString())
->count(); ->count();
} else { } else {
return 0; return 0;
} }
@ -317,13 +320,15 @@ function get_cooperation_notif() {
} }
if (! function_exists('slugify')) { if (! function_exists('slugify')) {
function slugify($param) { function slugify($param)
{
return Str::slug($param); return Str::slug($param);
} }
} }
if (! function_exists('get_unread_announcements')) { if (! function_exists('get_unread_announcements')) {
function get_unread_announcements() { function get_unread_announcements()
{
$user = User::findOrFail(Auth::id()); $user = User::findOrFail(Auth::id());
if ($user->role_id === 3) { if ($user->role_id === 3) {
$userId = $user->id; $userId = $user->id;
@ -332,7 +337,6 @@ function get_unread_announcements() {
return $user->announcements() return $user->announcements()
->wherePivot('status', '=', '0') ->wherePivot('status', '=', '0')
->count(); ->count();
} else { } else {
return 0; return 0;
} }
@ -340,7 +344,8 @@ function get_unread_announcements() {
} }
if (! function_exists('display_image')) { if (! function_exists('display_image')) {
function display_image($name, $dir = 'defaults', $default = 'default.jpg') { function display_image($name, $dir = 'defaults', $default = 'default.jpg')
{
$path = "uploads/{$dir}/{$name}"; $path = "uploads/{$dir}/{$name}";
$defaultPath = "assets/defaults/{$default}"; $defaultPath = "assets/defaults/{$default}";
@ -409,7 +414,8 @@ function get_user_agent($userAgentParam): array
} }
if (! function_exists('change_status')) { if (! function_exists('change_status')) {
function change_status($status, $category) { function change_status($status, $category)
{
if (in_array($category, ['company_edit', 'media_edit'])) { if (in_array($category, ['company_edit', 'media_edit'])) {
switch ($status) { switch ($status) {
case '0': case '0':
@ -426,7 +432,8 @@ function change_status($status, $category) {
} }
if (! function_exists('titlefy')) { if (! function_exists('titlefy')) {
function titlefy($text) { function titlefy($text)
{
if (filled($text)) { if (filled($text)) {
return Str::title($text); return Str::title($text);
} else { } else {
@ -436,7 +443,8 @@ function titlefy($text) {
} }
if (!function_exists('get_activity_log_name')) { if (!function_exists('get_activity_log_name')) {
function get_activity_log_name($name) { function get_activity_log_name($name)
{
switch ($name) { switch ($name) {
case 'airing_proof_theme': case 'airing_proof_theme':

24
config/view.php Normal file
View File

@ -0,0 +1,24 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];

View File

@ -1,22 +0,0 @@
services:
app:
container_name: purwakarta-diskominfo-simedkom
image: ${DOCKER_REGISTRY}/pratama/${IMAGE_NAME}:${IMAGE_TAG}
# build: .
ports:
- "8992:80"
env_file:
- slack.env
networks:
- gitlab-repo
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
networks:
gitlab-repo:
external: true

View File

@ -1,71 +0,0 @@
#!/bin/sh
cd /app
# Install dependency jika belum ada vendor/
if [ ! -d vendor ]; then
echo "Installing dependencies..."
composer install --no-interaction --prefer-dist --optimize-autoloader
fi
# Jika file .env tidak ada, copy dari slack.env
if [ ! -f .env ]; then
echo "Copying slack.env to .env"
cp slack.env .env
fi
php artisan cache:table
php artisan migrate
# Generate app key jika belum ada
if ! grep -q "APP_KEY=" .env || [ -z "$(php artisan key:generate --show 2>/dev/null)" ]; then
echo "Generating app key..."
php artisan key:generate
fi
# echo "Generating app key..."
# php artisan key:generate
# # Cek apakah database sudah terhubung
# if ! php artisan migrate:status > /dev/null 2>&1; then
# echo "Database connection failed. Please check your .env file."
# exit 1
# fi
# # Cek apakah optimize sudah bersih
# if ! php artisan optimize:clear > /dev/null 2>&1; then
# echo "Clearing optimize..."
# php artisan optimize:clear || {
# echo "Optimize clear failed. Please check your Laravel setup."
# exit 1
# }
# fi
# Cek apakah config sudah bersih
# if ! php artisan config:clear > /dev/null 2>&1; then
# echo "Clearing config cache..."
# php artisan config:clear || {
# echo "Config clear failed. Please check your Laravel setup."
# exit 1
# }
# fi
# Cek apakah route sudah bersih
# if ! php artisan route:clear > /dev/null 2>&1; then
# echo "Clearing route cache..."
# php artisan route:clear || {
# echo "Route clear failed. Please check your Laravel setup."
# exit 1
# }
# fi
# Jalankan migrasi
echo "Running migrations..."
#php artisan migrate --force || true
php artisan migrate:fresh --seed --force || true
echo "Seeding database..."
php artisan db:seed --force || true
# Start server
echo "Starting Laravel server..."
exec frankenphp php-server --root public

View File

@ -1,69 +0,0 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:PfCPtSPUU+C+slwgUm0TeUzy4sOcDslf0QEYtMt56bs=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=10.10.30.253
DB_PORT=3306
DB_DATABASE=simedkom
DB_USERNAME=simedkom
DB_PASSWORD=l2d7YsJm1EdWT4GvDk6B1URpLAm0Bu9h
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
S3_ACCESS_KEY=GCLSD4PCBWV9JJ09X6KB
S3_SECRET_KEY=+ABULfHK6uJ2nUQnymfQtxyssrZmCpGp6uSz7o3b
S3_REGION=pratama-live
S3_BUCKET_NAME=purwakarta-diskominfo-simedkom
S3_ENDPOINT_URL=http://s3.pratama.live
AWS_USE_PATH_STYLE_ENDPOINT=true
VITE_APP_NAME="${APP_NAME}"
RECAPTCHA_SITE_KEY=6Lcy9uEoAAAAALWxQu-0kuS_YAjGpDVpdk1FxPL8
RECAPTCHA_SECRET_KEY=6Lcy9uEoAAAAAIc54Fi8fPEbbJ9kYi9odkmUfdNy