all three containers works with alpine and user are configured
This commit is contained in:
@@ -2,10 +2,6 @@
|
||||
|
||||
# FROM debian:buster
|
||||
#
|
||||
# ARG DB_NAME
|
||||
# ARG DB_USER
|
||||
# ARG DB_PSWD
|
||||
#
|
||||
# RUN apt update && apt install -y \
|
||||
# mariadb-client \
|
||||
# mariadb-server \
|
||||
@@ -19,10 +15,6 @@
|
||||
|
||||
FROM alpine:3.15
|
||||
|
||||
ARG DB_NAME
|
||||
ARG DB_USER
|
||||
ARG DB_PSWD
|
||||
|
||||
# vim and bash for debug
|
||||
RUN apk update && apk add \
|
||||
mariadb \
|
||||
@@ -36,6 +28,10 @@
|
||||
|
||||
# common -----------------------------------------------------
|
||||
|
||||
ARG DB_NAME
|
||||
ARG DB_USER
|
||||
ARG DB_PSWD
|
||||
|
||||
# init mysql database
|
||||
RUN mysql_install_db --user=mysql --ldata=/var/lib/mysql && \
|
||||
mkdir -p /var/run/mysqld && \
|
||||
@@ -43,6 +39,9 @@ RUN mysql_install_db --user=mysql --ldata=/var/lib/mysql && \
|
||||
|
||||
# configure wp database
|
||||
COPY ./conf/create_db.sql /usr/bin/create_db.sql
|
||||
RUN sed -i "s/\${DB_NAME}/${DB_NAME}/g" /usr/bin/create_db.sql
|
||||
RUN sed -i "s/\${DB_USER}/${DB_USER}/g" /usr/bin/create_db.sql
|
||||
RUN sed -i "s/\${DB_PSWD}/${DB_PSWD}/g" /usr/bin/create_db.sql
|
||||
|
||||
ENTRYPOINT [ "mysqld", "--user=mysql", "--init-file=/usr/bin/create_db.sql" ]
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# < socket=/var/lib/mysql/mysql.sock
|
||||
# >
|
||||
|
||||
|
||||
#
|
||||
# These groups are read by MariaDB server.
|
||||
# Use it for options that only the server (but not clients) should see
|
||||
@@ -27,7 +26,7 @@
|
||||
skip-networking = false
|
||||
datadir = /var/lib/mysql
|
||||
port = 3306
|
||||
socket=/var/lib/mysql/mysql.sock
|
||||
socket=/run/mysqld/mysqld.sock
|
||||
|
||||
# Galera-related settings
|
||||
[galera]
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
COPY ./conf/nginx.conf.alpine /etc/nginx/nginx.conf
|
||||
COPY ./conf/inception_nginx.conf /etc/nginx/http.d/
|
||||
|
||||
# create user www-data and assign it to group www-data
|
||||
RUN adduser -S www-data && \
|
||||
adduser www-data www-data
|
||||
|
||||
# common -----------------------------------------------------
|
||||
|
||||
# personalized index.html
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
# inception modifications :
|
||||
#
|
||||
# user :
|
||||
# < user www-data
|
||||
# > user nginx
|
||||
|
||||
# /etc/nginx/nginx.conf
|
||||
|
||||
user nginx;
|
||||
user www-data;
|
||||
|
||||
# Set number of worker processes automatically based on number of CPU cores.
|
||||
worker_processes auto;
|
||||
|
||||
@@ -1,20 +1,54 @@
|
||||
FROM debian:buster
|
||||
# debian -----------------------------------------------------
|
||||
|
||||
# bash and vim for debug
|
||||
RUN apt update && apt install -y \
|
||||
php7.3 \
|
||||
php7.3-fpm \
|
||||
php7.3-mysqli \
|
||||
mariadb-client \
|
||||
curl \
|
||||
bash vim
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
# FROM debian:buster
|
||||
#
|
||||
# # bash and vim for debug
|
||||
# RUN apt update && apt install -y \
|
||||
# php7.3 \
|
||||
# php7.3-fpm \
|
||||
# php7.3-mysqli \
|
||||
# curl \
|
||||
# bash vim
|
||||
# RUN rm -rf /var/lib/apt/lists/*
|
||||
#
|
||||
# # fpm config
|
||||
# COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/
|
||||
# RUN mkdir /run/php/
|
||||
#
|
||||
# ENV PHP_VERSION="php-fpm7.3"
|
||||
|
||||
# fpm config
|
||||
COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/
|
||||
RUN mkdir /run/php/
|
||||
# alpine -----------------------------------------------------
|
||||
|
||||
# install wp-cli : https://make.wordpress.org/cli/handbook/guides/installing/
|
||||
FROM alpine:3.15
|
||||
|
||||
# bash and vim for debug
|
||||
RUN apk update && apk add \
|
||||
php7 \
|
||||
php7-fpm \
|
||||
php7-mysqli \
|
||||
php7-phar \
|
||||
php7-json \
|
||||
curl \
|
||||
bash vim
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# fpm config
|
||||
COPY ./conf/www.conf /etc/php7/php-fpm.d/
|
||||
RUN mkdir /run/php/
|
||||
|
||||
# create wp directory
|
||||
ARG WP_DIR
|
||||
RUN mkdir -p ${WP_DIR}
|
||||
|
||||
# create www-data user and add to group
|
||||
RUN adduser -S www-data && \
|
||||
adduser www-data www-data
|
||||
|
||||
ENV PHP_VERSION="php-fpm7"
|
||||
|
||||
# common -----------------------------------------------------
|
||||
|
||||
# install wp-cli : https://wp-cli.org/#installing
|
||||
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&\
|
||||
chmod +x wp-cli.phar && \
|
||||
mv wp-cli.phar /usr/local/bin/wp
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
mkdir -p ${WP_DIR}
|
||||
wp core download --path="${WP_DIR}" --allow-root
|
||||
|
||||
# mariadb --execute="CREATE DATABASE ${DB_NAME};" && \
|
||||
# mariadb --execute="CREATE USER '${DB_USER}'@'localhost' IDENTIFIED BY '${DB_PSWD}';" && \
|
||||
# mariadb --execute="GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO '${DB_USER}'@'localhost' with grant option;"
|
||||
|
||||
## create config file :
|
||||
wp config create \
|
||||
--dbhost=mariadb \
|
||||
@@ -28,11 +24,11 @@ wp core install \
|
||||
|
||||
## create user :
|
||||
wp user create \
|
||||
${WP_USER} ${WP_USER_EMAIL} \
|
||||
--user_pass=${WP_USER_PSWD} \
|
||||
--path=${WP_DIR} --allow-root
|
||||
chown -R nginx:nginx /var/www/*
|
||||
"${WP_USER}" "${WP_USER_EMAIL}" \
|
||||
--user_pass="${WP_USER_PSWD}" \
|
||||
--path="${WP_DIR}" --allow-root
|
||||
chown -R www-data:www-data /var/www/*
|
||||
chmod 755 -R /var/www/*
|
||||
|
||||
exec php-fpm7.3 -F
|
||||
#exec php-fpm7.3 --nodaemonize
|
||||
exec ${PHP_VERSION} -FR
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
; inception modifications :
|
||||
;
|
||||
; listen :
|
||||
; < listen = wordpress:9000
|
||||
; > listen = /run/php/php7.3-fpm.sock
|
||||
|
||||
Reference in New Issue
Block a user