Files
sidata/Dockerfile
T
gitea 811f9ee741
CI/CD Pipeline to Rancher - SIDATA / build-and-deploy (push) Failing after 3m13s
Fix registry and deployment configuration
2026-09-06 14:26:18 +07:00

81 lines
2.7 KiB
Docker

FROM registry-nexus-bpkd.drc-bpkd.data-center.id/php74-fpm-oci8-lengkap:1.0
ARG http_proxy
ARG https_proxy
ENV http_proxy=${http_proxy}
ENV https_proxy=${https_proxy}
ENV HTTP_PROXY=${http_proxy}
ENV HTTPS_PROXY=${https_proxy}
# =========================================================
# System dependencies & Extensions
# =========================================================
RUN echo "deb [trusted=yes] http://10.15.39.186:8081/repository/debian-proxy/ bullseye main" > /etc/apt/sources.list \
&& echo "deb [trusted=yes] http://10.15.39.186:8081/repository/debian-proxy/ bullseye-updates main" >> /etc/apt/sources.list \
&& rm -rf /etc/apt/sources.list.d/* \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
nginx \
redis-server \
procps \
vim \
wget \
curl \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
libaio1 \
libaio-dev \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd pdo pdo_mysql zip \
&& curl --noproxy "*" -fsSL http://10.15.39.186:8081/repository/raw-assets/storage/app/uploads/redis-5.3.7.tgz -o redis.tgz \
&& pecl install redis.tgz \
&& docker-php-ext-enable redis \
&& rm -f redis.tgz \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/html
# Salin source code aplikasi
COPY . /var/www/html
# Buat file .env dari .env.example jika .env belum ada di repositori
RUN if [ ! -f .env ]; then \
if [ -f .env.example ]; then \
cp .env.example .env; \
else \
echo "APP_NAME=Sidata\nAPP_ENV=production\nAPP_KEY=\nAPP_DEBUG=true\nAPP_URL=https://dashboard-bpkd.drc-bpkd.data-center.id/sidata" > .env; \
fi \
fi
# Atur hak akses folder web, storage, dan cache Laravel
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 775 /var/www/html/storage \
&& chmod -R 775 /var/www/html/bootstrap/cache
# Konfigurasi Nginx Standar Laravel (Merespons di Root /)
RUN echo 'server { \
listen 80; \
index index.php index.html; \
root /var/www/html/public; \
\
location / { \
try_files $uri $uri/ /index.php?$query_string; \
} \
\
location ~ \.php$ { \
fastcgi_pass 127.0.0.1:9000; \
fastcgi_index index.php; \
include fastcgi_params; \
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; \
} \
}' > /etc/nginx/sites-available/default
EXPOSE 80
# Script startup: Buat .env dari variabel environment Helm, lalu jalankan service
CMD ["sh", "-c", "env | grep -E '^(APP_|DB_|MYSQL_|ORA_|REDIS_|MAIL_|SESSION_|SOA_)' > /var/www/html/.env && redis-server --daemonize yes && php-fpm -D && exec nginx -g 'daemon off;'"]