Files
sidata/Dockerfile
T
gitea 3ed5d62bda
CI/CD Pipeline to Rancher - SIDATA / build-and-deploy (push) Failing after 42s
fix: update CI/CD pipeline
2026-09-07 13:31:39 +07:00

140 lines
4.0 KiB
Docker

FROM registry-nexus-bpkd.drc-bpkd.data-center.id/php74-fpm-oci8-lengkap:1.0
# =========================================================
# Build arguments
# =========================================================
ARG http_proxy
ARG https_proxy
ARG no_proxy
# Proxy hanya untuk proses build.
# Registry internal harus bypass proxy.
ENV http_proxy=${http_proxy}
ENV https_proxy=${https_proxy}
ENV HTTP_PROXY=${http_proxy}
ENV HTTPS_PROXY=${https_proxy}
ENV no_proxy=${no_proxy}
ENV NO_PROXY=${no_proxy}
# =========================================================
# System dependencies & Extensions
# =========================================================
RUN set -eux; \
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 /tmp/redis.tgz; \
pecl install /tmp/redis.tgz; \
docker-php-ext-enable redis; \
rm -f /tmp/redis.tgz; \
rm -rf /var/lib/apt/lists/*
# =========================================================
# Application
# =========================================================
WORKDIR /var/www/html
COPY . /var/www/html
# =========================================================
# Laravel environment
# =========================================================
RUN set -eux; \
if [ ! -f .env ]; then \
if [ -f .env.example ]; then \
cp .env.example .env; \
else \
printf '%s\n' \
'APP_NAME=Sidata' \
'APP_ENV=production' \
'APP_KEY=' \
'APP_DEBUG=false' \
'APP_URL=https://dashboard-bpkd.drc-bpkd.data-center.id/sidata' \
> .env; \
fi; \
fi
# =========================================================
# Permission
# =========================================================
RUN set -eux; \
mkdir -p \
/var/www/html/storage \
/var/www/html/bootstrap/cache; \
chown -R www-data:www-data /var/www/html; \
chmod -R 775 /var/www/html/storage; \
chmod -R 775 /var/www/html/bootstrap/cache
# =========================================================
# Nginx configuration
# =========================================================
RUN printf '%s\n' \
'server {' \
' listen 80;' \
' server_name _;' \
' index index.php index.html;' \
' root /var/www/html/public;' \
'' \
' location / {' \
' try_files $uri $uri/ /index.php?$query_string;' \
' }' \
'' \
' location ~ \.php$ {' \
' try_files $uri =404;' \
' fastcgi_pass 127.0.0.1:9000;' \
' fastcgi_index index.php;' \
' include fastcgi_params;' \
' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' \
' }' \
'' \
' location ~ /\.ht {' \
' deny all;' \
' }' \
'}' \
> /etc/nginx/sites-available/default
# =========================================================
# Runtime
# =========================================================
EXPOSE 80
CMD ["sh", "-c", "\
env | grep -E '^(APP_|DB_|MYSQL_|ORA_|REDIS_|MAIL_|SESSION_|SOA_)' > /var/www/html/.env; \
chown www-data:www-data /var/www/html/.env; \
redis-server --daemonize yes; \
php-fpm -D; \
exec nginx -g 'daemon off;' \
"]