You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.2 KiB
30 lines
1.2 KiB
FROM nginx:1.25.1
|
|
|
|
WORKDIR /var/www/
|
|
|
|
# 安裝 PHP 和相關擴展
|
|
RUN groupadd --system --gid 1000 www \
|
|
&& useradd --system --gid www --no-create-home --home /nonexistent --comment "www user" --shell /bin/false --uid 1000 www \
|
|
&& ln -snf /usr/share/zoneinfo/Asia/Taipei /etc/localtime \
|
|
&& echo "Asia/Taipei" > /etc/timezone \
|
|
&& dpkg-reconfigure -f noninteractive tzdata \
|
|
&& apt-get update && apt-get install -y vim lsb-release apt-transport-https ca-certificates wget \
|
|
&& wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg \
|
|
&& echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list \
|
|
&& apt-get update \
|
|
&& apt-get install -y php8.0 php8.0-fpm php8.0-mysql php8.0-xml php8.0-gd php8.0-curl
|
|
|
|
RUN mkdir -p /var/www/ && chown -R www:www /var/www
|
|
|
|
# 複製 Nginx 配置文件
|
|
COPY nginx-php/nginx.conf /etc/nginx/nginx.conf
|
|
COPY nginx-php/default.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# 複製 PHP-FPM 配置文件
|
|
COPY nginx-php/www.conf /etc/php/8.0/fpm/pool.d/www.conf
|
|
|
|
COPY --chown=www:www app /var/www/
|
|
|
|
# 將 PHP-FPM 服務啟動
|
|
CMD service php8.0-fpm start && nginx -g 'daemon off;'
|