109 lines
4.3 KiB
Docker
109 lines
4.3 KiB
Docker
FROM registry-nexus-bpkd.drc-bpkd.data-center.id/php74-fpm-oci8-lengkap:1.0
|
|
|
|
# =========================================================
|
|
# Build arguments & Environment variables
|
|
# =========================================================
|
|
ARG http_proxy
|
|
ARG https_proxy
|
|
ARG no_proxy
|
|
ARG HTTP_PROXY
|
|
ARG HTTPS_PROXY
|
|
ARG NO_PROXY
|
|
|
|
ENV http_proxy=${http_proxy} \
|
|
https_proxy=${https_proxy} \
|
|
no_proxy=${no_proxy} \
|
|
HTTP_PROXY=${HTTP_PROXY} \
|
|
HTTPS_PROXY=${HTTPS_PROXY} \
|
|
NO_PROXY=${NO_PROXY}
|
|
|
|
# =========================================================
|
|
# System dependencies
|
|
# =========================================================
|
|
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 permissions
|
|
# =========================================================
|
|
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 /var/www/html/bootstrap/cache
|
|
|
|
# =========================================================
|
|
# Nginx configuration
|
|
# =========================================================
|
|
RUN set -eux; \
|
|
rm -f /etc/nginx/sites-enabled/default /etc/nginx/sites-available/default; \
|
|
printf '%s\n' \
|
|
'server {' \
|
|
' listen 80;' \
|
|
' server_name _;' \
|
|
' root /var/www/html/public;' \
|
|
' index index.php index.html;' \
|
|
'' \
|
|
' location / {' \
|
|
' try_files $uri $uri/ /index.php?$query_string;' \
|
|
' }' \
|
|
'' \
|
|
' location ~ \.php$ {' \
|
|
' try_files $uri =404;' \
|
|
' include fastcgi_params;' \
|
|
' fastcgi_pass 127.0.0.1:9000;' \
|
|
' fastcgi_index index.php;' \
|
|
' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' \
|
|
' fastcgi_param HTTP_X_FORWARDED_PROTO $http_x_forwarded_proto;' \
|
|
' fastcgi_param HTTP_X_FORWARDED_PREFIX /sidataprod;' \
|
|
' }' \
|
|
'' \
|
|
' location ~ /\.ht {' \
|
|
' deny all;' \
|
|
' }' \
|
|
'}' > /etc/nginx/sites-available/default; \
|
|
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default; \
|
|
mkdir -p /run/nginx
|
|
|
|
# =========================================================
|
|
# Laravel URL & Environment Variables
|
|
# =========================================================
|
|
ENV APP_ENV=production \
|
|
APP_DEBUG=false \
|
|
APP_URL=https://dashboard-bpkd.drc-bpkd.data-center.id/sidataprod
|
|
|
|
# =========================================================
|
|
# Expose & Startup
|
|
# =========================================================
|
|
EXPOSE 80
|
|
|
|
CMD ["sh", "-c", "set -e; if [ ! -f /var/www/html/.env ]; then if [ -f /var/www/html/.env.example ]; then cp /var/www/html/.env.example /var/www/html/.env; else touch /var/www/html/.env; fi; fi; tmp_env=$(mktemp); env | grep -E '^(APP_|DB_|MYSQL_|ORA_|REDIS_|MAIL_|SESSION_|SOA_)' > \"$tmp_env\" || true; if [ -s \"$tmp_env\" ]; then cat \"$tmp_env\" > /var/www/html/.env; fi; rm -f \"$tmp_env\"; chown www-data:www-data /var/www/html/.env; chmod 664 /var/www/html/.env; redis-server --daemonize yes; php-fpm -D; exec nginx -g 'daemon off;'"] |