104 lines
3.6 KiB
Docker
104 lines
3.6 KiB
Docker
FROM registry-nexus-bpkd.drc-bpkd.data-center.id/php74-fpm-oci8-lengkap:1.0
|
|
|
|
ARG http_proxy
|
|
ARG https_proxy
|
|
ARG HTTP_PROXY
|
|
ARG HTTPS_PROXY
|
|
ARG no_proxy
|
|
ARG NO_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
|
|
# =========================================================
|
|
|
|
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 /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 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 rm -f /etc/nginx/sites-enabled/default \
|
|
&& rm -f /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;' \
|
|
' }' \
|
|
'}' > /etc/nginx/sites-available/default \
|
|
&& ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
|
|
|
|
# =========================================================
|
|
# Nginx
|
|
# =========================================================
|
|
|
|
RUN mkdir -p /run/nginx
|
|
|
|
EXPOSE 80
|
|
|
|
# =========================================================
|
|
# Startup
|
|
# =========================================================
|
|
|
|
CMD ["sh", "-c", "if [ -f /var/www/html/.env.example ] && [ ! -f /var/www/html/.env ]; then cp /var/www/html/.env.example /var/www/html/.env; fi; env | grep -E '^(APP_|DB_|MYSQL_|ORA_|REDIS_|MAIL_|SESSION_|SOA_)' > /var/www/html/.env 2>/dev/null || true; chown www-data:www-data /var/www/html/.env 2>/dev/null || true; redis-server --daemonize yes; php-fpm -D; exec nginx -g 'daemon off;'"]
|