Files
sidata/Dockerfile
T

74 lines
2.6 KiB
Docker

FROM 10.15.39.186:8083/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
# Install Composer dan arahkan Packagist ke Nexus
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer config repo.packagist composer http://10.15.39.186:8081/repository/composer-proxy/ \
&& composer config secure-http false \
&& composer install --prefer-dist --no-dev --optimize-autoloader --no-interaction
# 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 /var/www/html/bootstrap/cache
# Konfigurasi Nginx
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
CMD ["sh", "-c", "redis-server --daemonize yes && php-fpm -D && exec nginx -g 'daemon off;'"]