Commit 21fbbcab authored by Simonas's avatar Simonas

in progress

parent 1b8a78e2
FROM php:7.2-fpm
# install the PHP extensions we need
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libjpeg-dev \
libpng-dev \
; \
\
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-install gd mysqli opcache zip; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
VOLUME /var/www/html
ENV WORDPRESS_VERSION 4.9.8
ENV WORDPRESS_SHA1 0945bab959cba127531dceb2c4fed81770812b4f
RUN set -ex; \
curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz"; \
echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c -; \
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
tar -xzf wordpress.tar.gz -C /usr/src/; \
rm wordpress.tar.gz; \
chown -R www-data:www-data /usr/src/wordpress
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["php-fpm"]
#!/bin/bash
set -euo pipefail
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
pound='#'
user="${user#$pound}"
group="${group#$pound}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$(id -u)"
group="$(id -g)"
fi
if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then
echo >&2 "WordPress not found in $PWD - copying now..."
if [ -n "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
fi
sourceTarArgs=(
--create
--file -
--directory /usr/src/wordpress
--owner "$user" --group "$group"
)
targetTarArgs=(
--extract
--file -
)
if [ "$user" != '0' ]; then
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
targetTarArgs+=( --no-overwrite-dir )
fi
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
if [ ! -e .htaccess ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image
cat > .htaccess <<-'EOF'
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
EOF
chown "$user:$group" .htaccess
fi
fi
# TODO handle WordPress upgrades magically in the same way, but only if wp-includes/version.php's $wp_version is less than /usr/src/wordpress/wp-includes/version.php's $wp_version
# allow any of these "Authentication Unique Keys and Salts." to be specified via
# environment variables with a "WORDPRESS_" prefix (ie, "WORDPRESS_AUTH_KEY")
uniqueEnvs=(
AUTH_KEY
SECURE_AUTH_KEY
LOGGED_IN_KEY
NONCE_KEY
AUTH_SALT
SECURE_AUTH_SALT
LOGGED_IN_SALT
NONCE_SALT
)
envs=(
WORDPRESS_DB_HOST
WORDPRESS_DB_USER
WORDPRESS_DB_PASSWORD
WORDPRESS_DB_NAME
WORDPRESS_DB_CHARSET
WORDPRESS_DB_COLLATE
"${uniqueEnvs[@]/#/WORDPRESS_}"
WORDPRESS_TABLE_PREFIX
WORDPRESS_DEBUG
WORDPRESS_CONFIG_EXTRA
)
haveConfig=
for e in "${envs[@]}"; do
file_env "$e"
if [ -z "$haveConfig" ] && [ -n "${!e}" ]; then
haveConfig=1
fi
done
# linking backwards-compatibility
if [ -n "${!MYSQL_ENV_MYSQL_*}" ]; then
haveConfig=1
# host defaults to "mysql" below if unspecified
: "${WORDPRESS_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}"
if [ "$WORDPRESS_DB_USER" = 'root' ]; then
: "${WORDPRESS_DB_PASSWORD:=${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}"
else
: "${WORDPRESS_DB_PASSWORD:=${MYSQL_ENV_MYSQL_PASSWORD:-}}"
fi
: "${WORDPRESS_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-}}"
fi
# only touch "wp-config.php" if we have environment-supplied configuration values
if [ "$haveConfig" ]; then
: "${WORDPRESS_DB_HOST:=mysql}"
: "${WORDPRESS_DB_USER:=root}"
: "${WORDPRESS_DB_PASSWORD:=}"
: "${WORDPRESS_DB_NAME:=wordpress}"
: "${WORDPRESS_DB_CHARSET:=utf8}"
: "${WORDPRESS_DB_COLLATE:=}"
# version 4.4.1 decided to switch to windows line endings, that breaks our seds and awks
# https://github.com/docker-library/wordpress/issues/116
# https://github.com/WordPress/WordPress/commit/1acedc542fba2482bab88ec70d4bea4b997a92e4
sed -ri -e 's/\r$//' wp-config*
if [ ! -e wp-config.php ]; then
awk '
/^\/\*.*stop editing.*\*\/$/ && c == 0 {
c = 1
system("cat")
if (ENVIRON["WORDPRESS_CONFIG_EXTRA"]) {
print "// WORDPRESS_CONFIG_EXTRA"
print ENVIRON["WORDPRESS_CONFIG_EXTRA"] "\n"
}
}
{ print }
' wp-config-sample.php > wp-config.php <<'EOPHP'
// If we're behind a proxy server and using HTTPS, we need to alert Wordpress of that fact
// see also http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}
EOPHP
chown "$user:$group" wp-config.php
elif [ -e wp-config.php ] && [ -n "$WORDPRESS_CONFIG_EXTRA" ] && [[ "$(< wp-config.php)" != *"$WORDPRESS_CONFIG_EXTRA"* ]]; then
# (if the config file already contains the requested PHP code, don't print a warning)
echo >&2
echo >&2 'WARNING: environment variable "WORDPRESS_CONFIG_EXTRA" is set, but "wp-config.php" already exists'
echo >&2 ' The contents of this variable will _not_ be inserted into the existing "wp-config.php" file.'
echo >&2 ' (see https://github.com/docker-library/wordpress/issues/333 for more details)'
echo >&2
fi
# see http://stackoverflow.com/a/2705678/433558
sed_escape_lhs() {
echo "$@" | sed -e 's/[]\/$*.^|[]/\\&/g'
}
sed_escape_rhs() {
echo "$@" | sed -e 's/[\/&]/\\&/g'
}
php_escape() {
local escaped="$(php -r 'var_export(('"$2"') $argv[1]);' -- "$1")"
if [ "$2" = 'string' ] && [ "${escaped:0:1}" = "'" ]; then
escaped="${escaped//$'\n'/"' + \"\\n\" + '"}"
fi
echo "$escaped"
}
set_config() {
key="$1"
value="$2"
var_type="${3:-string}"
start="(['\"])$(sed_escape_lhs "$key")\2\s*,"
end="\);"
if [ "${key:0:1}" = '$' ]; then
start="^(\s*)$(sed_escape_lhs "$key")\s*="
end=";"
fi
sed -ri -e "s/($start\s*).*($end)$/\1$(sed_escape_rhs "$(php_escape "$value" "$var_type")")\3/" wp-config.php
}
set_config 'DB_HOST' "$WORDPRESS_DB_HOST"
set_config 'DB_USER' "$WORDPRESS_DB_USER"
set_config 'DB_PASSWORD' "$WORDPRESS_DB_PASSWORD"
set_config 'DB_NAME' "$WORDPRESS_DB_NAME"
set_config 'DB_CHARSET' "$WORDPRESS_DB_CHARSET"
set_config 'DB_COLLATE' "$WORDPRESS_DB_COLLATE"
for unique in "${uniqueEnvs[@]}"; do
uniqVar="WORDPRESS_$unique"
if [ -n "${!uniqVar}" ]; then
set_config "$unique" "${!uniqVar}"
else
# if not specified, let's generate a random value
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
if [ "$currentVal" = 'put your unique phrase here' ]; then
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
fi
fi
done
if [ "$WORDPRESS_TABLE_PREFIX" ]; then
set_config '$table_prefix' "$WORDPRESS_TABLE_PREFIX"
fi
if [ "$WORDPRESS_DEBUG" ]; then
set_config 'WP_DEBUG' 1 boolean
fi
TERM=dumb php -- <<'EOPHP'
<?php
// database might not exist, so let's try creating it (just to be safe)
$stderr = fopen('php://stderr', 'w');
// https://codex.wordpress.org/Editing_wp-config.php#MySQL_Alternate_Port
// "hostname:port"
// https://codex.wordpress.org/Editing_wp-config.php#MySQL_Sockets_or_Pipes
// "hostname:unix-socket-path"
list($host, $socket) = explode(':', getenv('WORDPRESS_DB_HOST'), 2);
$port = 0;
if (is_numeric($socket)) {
$port = (int) $socket;
$socket = null;
}
$user = getenv('WORDPRESS_DB_USER');
$pass = getenv('WORDPRESS_DB_PASSWORD');
$dbName = getenv('WORDPRESS_DB_NAME');
$maxTries = 10;
do {
$mysql = new mysqli($host, $user, $pass, '', $port, $socket);
if ($mysql->connect_error) {
fwrite($stderr, "\n" . 'MySQL Connection Error: (' . $mysql->connect_errno . ') ' . $mysql->connect_error . "\n");
--$maxTries;
if ($maxTries <= 0) {
exit(1);
}
sleep(3);
}
} while ($mysql->connect_error);
if (!$mysql->query('CREATE DATABASE IF NOT EXISTS `' . $mysql->real_escape_string($dbName) . '`')) {
fwrite($stderr, "\n" . 'MySQL "CREATE DATABASE" Error: ' . $mysql->error . "\n");
$mysql->close();
exit(1);
}
$mysql->close();
EOPHP
fi
# now that we're definitely done writing configuration, let's clear out the relevant envrionment variables (so that stray "phpinfo()" calls don't leak secrets from our code)
for e in "${envs[@]}"; do
unset "$e"
done
fi
exec "$@"
https://ansi.23-5.eu/2017/06/wordpress-docker-nginx/
docker run -d --name wordpress -p 80:80 -p 443:443 \
--net wordpress-tier \
--env MARIADB_HOST=mariadb_host \
--env MARIADB_PORT_NUMBER=3306 \
--env WORDPRESS_DATABASE_NAME=wordpress_db \
--env WORDPRESS_DATABASE_USER=wordpress_user \
--env WORDPRESS_DATABASE_PASSWORD=wordpress_password \
--volume wordpress_data:/bitnami \
--volume ./wordpress-vhosts.conf:/bitnami/nginx/conf/vhosts/wordpress-vhosts.conf \
bitnami/wordpress-nginx:latest
docker-compose up --build -d
# wordpress-nginx-docker # wordpress-nginx-docker
Docker compose installation of a single site Wordpress instance using Nginx as the web server and MariaDB as the database. Docker compose installation of a single site Wordpress instance using Nginx as the web server and MariaDB as the database.
...@@ -31,7 +61,7 @@ $ cd wordpress-nginx-docker/ ...@@ -31,7 +61,7 @@ $ cd wordpress-nginx-docker/
If you plan to run your WordPress site over http on port 80, then do the following. If you plan to run your WordPress site over http on port 80, then do the following.
1. Change the name of `nginx/wordpress.conf.example` to `nginx/wordpress.conf` 1. Change the name of `nginx/wordpress.conf.example` to `nginx/wordpress.conf`
2. Update the `DOMAIN_NAME` in `nginx/wordpress.conf` to be that of your domain 2. Update the `DOMAIN_NAME` in `nginx/wordpress.conf` to be that of your domain
3. Run `$ docker-compose up -d` 3. Run `$ docker-compose up -d`
4. Navigate to [http://DOMAIN_NAME]() in a browser where `DOMAIN_NAME` is the name of your site 4. Navigate to [http://DOMAIN_NAME]() in a browser where `DOMAIN_NAME` is the name of your site
...@@ -45,9 +75,9 @@ If you plan to run your WordPress site over https on port 443, then do the follo ...@@ -45,9 +75,9 @@ If you plan to run your WordPress site over https on port 443, then do the follo
- **Let's Encrypt** - **Let's Encrypt**
If you plan on using SSL certificates from [Let's Encrypt](https://letsencrypt.org) it is important that your public domain is already registered and reachable. If you plan on using SSL certificates from [Let's Encrypt](https://letsencrypt.org) it is important that your public domain is already registered and reachable.
Run: `./letsencrypt/letsencrypt-init.sh DOMAIN_NAME`, where `DOMAIN_NAME` is the publicly registered domain name of your host. Run: `./letsencrypt/letsencrypt-init.sh DOMAIN_NAME`, where `DOMAIN_NAME` is the publicly registered domain name of your host.
``` ```
$ ./letsencrypt-init.sh example.com $ ./letsencrypt-init.sh example.com
mysql uses an image, skipping mysql uses an image, skipping
...@@ -64,7 +94,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo ...@@ -64,7 +94,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo
Plugins selected: Authenticator webroot, Installer None Plugins selected: Authenticator webroot, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): mjstealey@gmail.com cancel): mjstealey@gmail.com
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Please read the Terms of Service at Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf. You must agree https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf. You must agree
...@@ -72,7 +102,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo ...@@ -72,7 +102,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo
https://acme-v01.api.letsencrypt.org/directory https://acme-v01.api.letsencrypt.org/directory
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
(A)gree/(C)ancel: a (A)gree/(C)ancel: a
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit Foundation, a founding partner of the Let's Encrypt project and the non-profit
...@@ -87,7 +117,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo ...@@ -87,7 +117,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo
Using the webroot path /data/letsencrypt for all unmatched domains. Using the webroot path /data/letsencrypt for all unmatched domains.
Waiting for verification... Waiting for verification...
Cleaning up challenges Cleaning up challenges
IMPORTANT NOTES: IMPORTANT NOTES:
ssl on; ssl on;
- Congratulations! Your certificate and chain have been saved at: - Congratulations! Your certificate and chain have been saved at:
...@@ -104,10 +134,10 @@ If you plan to run your WordPress site over https on port 443, then do the follo ...@@ -104,10 +134,10 @@ If you plan to run your WordPress site over https on port 443, then do the follo
also contain certificates and private keys obtained by Certbot so also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal. making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by: - If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le Donating to EFF: https://eff.org/donate-le
Stopping nginx ... done Stopping nginx ... done
Stopping wordpress ... done Stopping wordpress ... done
Stopping mysql ... done Stopping mysql ... done
...@@ -125,7 +155,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo ...@@ -125,7 +155,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo
- **Self signed** - **Self signed**
If you plan on using self signed SSL certificates, run: `./letsencrypt/self-signed-init.sh DOMAIN_NAME`, where `DOMAIN_NAME` is the `CN` you want to assign to the host (commonly `localhost`). If you plan on using self signed SSL certificates, run: `./letsencrypt/self-signed-init.sh DOMAIN_NAME`, where `DOMAIN_NAME` is the `CN` you want to assign to the host (commonly `localhost`).
``` ```
$ cd letsencrypt/ $ cd letsencrypt/
$ ./self-signed-init.sh localhost $ ./self-signed-init.sh localhost
...@@ -149,7 +179,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo ...@@ -149,7 +179,7 @@ If you plan to run your WordPress site over https on port 443, then do the follo
**Finally** **Finally**
1. Change the name of `nginx/wordpress_ssl.conf.example` to `nginx/wordpress_ssl.conf` 1. Change the name of `nginx/wordpress_ssl.conf.example` to `nginx/wordpress_ssl.conf`
2. Update the `DOMAIN_NAME` in `nginx/wordpress_ssl.conf` to be that of your domain 2. Update the `DOMAIN_NAME` in `nginx/wordpress_ssl.conf` to be that of your domain
3. Run `$ docker-compose up -d` 3. Run `$ docker-compose up -d`
4. Navigate to [https://DOMAIN_NAME]() in a browser where `DOMAIN_NAME` is the name of your site 4. Navigate to [https://DOMAIN_NAME]() in a browser where `DOMAIN_NAME` is the name of your site
......
PROJECT=biuro
NGINX_TAG=1.15.7
MARIADB_TAG=10.3
WORDPRESS_TAG=php7.2-fpm
DB_NAME=wordpress
DB_HOST=mysql
# DB_USER=wordpress
# DB_PASSWORD=wordpress
DB_ROOT_PASSWORD=IiIjnsLi2wR9i1kWVbVpUAzP
FROM php:7.2-fpm FROM nginx:1.15.7
# install the PHP extensions we need LABEL maintainer="Biuro<info@biuro.lt>"
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libjpeg-dev \
libpng-dev \
; \
\
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-install gd mysqli opcache zip; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
# set recommended PHP.ini settings COPY ./nginx/biuro.conf /etc/nginx/conf.d/default.conf
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
VOLUME /var/www/html # COPY ./wordpress /usr/share/nginx/html
# COPY ./app /usr/share/nginx/html
ENV WORDPRESS_VERSION 4.9.8 # VOLUME /var/log/nginx/log/
ENV WORDPRESS_SHA1 0945bab959cba127531dceb2c4fed81770812b4f
RUN set -ex; \
curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz"; \
echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c -; \
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
tar -xzf wordpress.tar.gz -C /usr/src/; \
rm wordpress.tar.gz; \
chown -R www-data:www-data /usr/src/wordpress
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"] ## Install Wordpress
CMD ["php-fpm"] #ADD https://wordpress.org/latest.tar.gz /var/www/latest.tar.gz
#RUN cd /var/www && tar zxf latest.tar.gz && rm latest.tar.gz
#RUN rm -rf /var/www/html
#RUN mv /var/www/wordpress /var/www/html
#RUN chown -R www-data:www-data /var/www/html
#
## Wordpress Initialization and Startup Script
#ADD ./start.sh /start.sh
#RUN chmod 755 /start.sh
#
## private expose
#EXPOSE 80
#EXPOSE 443
#
## volume for wordpress install
#VOLUME ["/var/www/html"]
#
#CMD ["/bin/bash", "/start.sh"]
...@@ -87,6 +87,46 @@ Restart docker (sometimes PC restart may be required) ...@@ -87,6 +87,46 @@ Restart docker (sometimes PC restart may be required)
- docker restart nginx - docker restart nginx
- docker restart wordpress - docker restart wordpress
docker push simoncereska/ourdemo
docker pull simoncereska/ourdemo:0.0.0
docker login --username=simoncereska --password=rlgjsPeOuF2T6VgW8fGss81h
docker build -t simoncereska/ourdemo:0.0.0 .
curl docker
docker run -d -p 80:80 release:0.0.0
docker run -d -p 80:80 webserver-image:v1
docker run -it simoncereska/ourdemo
docker build -t release:0.0.0 .
docker run -d -p 80:80 simoncereska/ourdemo:0.0.1
curl docker
docker images
docker rmi 568c4670fa80
docker save ourdemo > ourdemo.tar
docker load --input ourdemo.tar
docker build -t release:0.0.0 .
docker run -d -p 80:80 -p 443:443 release:0.0.0
c6b6b1595794
### DB preview ### DB preview
- `docker exec -it mysql bash` - `docker exec -it mysql bash`
- `mysql -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8` - `mysql -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8`
...@@ -96,4 +136,7 @@ Restart docker (sometimes PC restart may be required) ...@@ -96,4 +136,7 @@ Restart docker (sometimes PC restart may be required)
- `use information_schema;` - `use information_schema;`
- `select * from SCHEMATA;` - `select * from SCHEMATA;`
### READ list
- https://ansi.23-5.eu/2017/06/wordpress-docker-nginx/
- https://ropenscilabs.github.io/r-docker-tutorial/04-Dockerhub.html
- https://www.katacoda.com/courses/docker/
version: '3.7' version: '3.6'
services: services:
nginx: nginx:
image: nginx:latest image: nginx:${NGINX_TAG}
container_name: nginx container_name: "${PROJECT}-nginx"
networks:
- "local-network"
ports: ports:
- '80:80' - '80:80'
- '443:443' - '443:443'
...@@ -18,28 +20,36 @@ services: ...@@ -18,28 +20,36 @@ services:
restart: always restart: always
mysql: mysql:
image: mariadb:10.3 image: mariadb:${MARIADB_TAG}
container_name: mysql container_name: "${PROJECT}-mysql"
networks:
- "local-network"
ports: ports:
- '3306:3306' - '3306:3306'
volumes: volumes:
- ./docker/mariadb:/docker-entrypoint-initdb.d/ - ./docker/mariadb:/docker-entrypoint-initdb.d/
- ./var/mariadb:/var/lib/mysql - ./var/mariadb:/var/lib/mysql
environment: environment:
- MYSQL_ROOT_PASSWORD=IiIjnsLi2wR9i1kWVbVpUAzP - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci --innodb-flush-method=fsync command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci --innodb-flush-method=fsync
restart: always restart: always
wordpress: wordpress:
image: wordpress:php7.2-fpm image: wordpress:${WORDPRESS_TAG}
container_name: wordpress container_name: "${PROJECT}-wordpress"
networks:
- "local-network"
volumes: volumes:
- ./wordpress:/var/www/html - ./wordpress:/var/www/html
environment: environment:
- WORDPRESS_DB_NAME=wordpress - WORDPRESS_DB_NAME=${DB_NAME}
- WORDPRESS_TABLE_PREFIX=wp_ - WORDPRESS_TABLE_PREFIX=wp_
- WORDPRESS_DB_HOST=mysql - WORDPRESS_DB_HOST=${DB_HOST}
- WORDPRESS_DB_PASSWORD=IiIjnsLi2wR9i1kWVbVpUAzP - WORDPRESS_DB_PASSWORD=${DB_ROOT_PASSWORD}
links: links:
- mysql - mysql
restart: always restart: always
networks:
local-network:
name: "${PROJECT}-network"
webpackHotUpdate("main",{
/***/ "./js/main.js":
/*!********************!*\
!*** ./js/main.js ***!
\********************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("var cb = function cb() {\n 'use strict';\n\n var l = document.createElement('link'),\n h = document.getElementsByTagName('head')[0]; // oldIE =document.all && !document.addEventListener;\n\n l.rel = 'stylesheet';\n l.href = '/wp-content/themes/biuro/css/main.min.css'; // l.href = (oldIE) ? 'mysite/css/main-fixed.css' : 'mysite/css/main-responsive.css';\n\n h.parentNode.insertBefore(l, h);\n},\n raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;\n\nif (raf) {\n raf(cb);\n} else {\n if (window.addEventListener) {\n window.addEventListener('load', cb);\n } else {\n window.attachEvent('onload', cb);\n }\n}\n\n(function (global) {\n var container = document.getElementById('cookie-warning');\n var btnAgree = document.getElementById('cookie-agree');\n var btnClose = document.getElementById('cookie-close');\n var agreed = useLS() ? localStorage.getItem('biuro-agree') : false;\n\n function useLS() {\n var mod = 'a';\n\n try {\n localStorage.setItem(mod, mod);\n localStorage.removeItem(mod);\n return true;\n } catch (e) {\n return false;\n }\n }\n\n if (!container || !btnAgree || !btnClose || agreed) {\n return;\n }\n\n container.style.display = 'block';\n btnAgree.addEventListener('click', function () {\n if (useLS()) {\n localStorage.setItem('biuro-agree', 'true');\n }\n\n container.style.display = 'none';\n });\n btnClose.addEventListener('click', function () {\n container.style.display = 'none';\n });\n})(window);\n\nconsole.log('here goes main I'); // console.log('here goes main II');\n// console.log('here goes main III');\n\n//# sourceURL=webpack:///./js/main.js?");
/***/ })
})
\ No newline at end of file
webpackHotUpdate("main",{
/***/ "./js/main.js":
/*!********************!*\
!*** ./js/main.js ***!
\********************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("var cb = function cb() {\n 'use strict';\n\n var l = document.createElement('link'),\n h = document.getElementsByTagName('head')[0]; // oldIE =document.all && !document.addEventListener;\n\n l.rel = 'stylesheet';\n l.href = '/wp-content/themes/biuro/css/main.min.css'; // l.href = (oldIE) ? 'mysite/css/main-fixed.css' : 'mysite/css/main-responsive.css';\n\n h.parentNode.insertBefore(l, h);\n},\n raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;\n\nif (raf) {\n raf(cb);\n} else {\n if (window.addEventListener) {\n window.addEventListener('load', cb);\n } else {\n window.attachEvent('onload', cb);\n }\n}\n\n(function (global) {\n var container = document.getElementById('cookie-warning');\n var btnAgree = document.getElementById('cookie-agree');\n var btnClose = document.getElementById('cookie-close');\n var agreed = useLocalStorage() ? localStorage.getItem('biuro-agree') : false;\n\n function useLocalStorage() {\n var mod = 'a';\n\n try {\n localStorage.setItem(mod, mod);\n localStorage.removeItem(mod);\n return true;\n } catch (e) {\n return false;\n }\n }\n\n if (!container || !btnAgree || !btnClose || agreed) {\n return;\n }\n\n container.style.display = 'block';\n btnAgree.addEventListener('click', function () {\n if (useLocalStorage()) {\n localStorage.setItem('biuro-agree', 'true');\n }\n\n container.style.display = 'none';\n });\n btnClose.addEventListener('click', function () {\n container.style.display = 'none';\n });\n})(window);\n\nconsole.log('here goes main I'); // console.log('here goes main II');\n// console.log('here goes main III');\n\n//# sourceURL=webpack:///./js/main.js?");
/***/ })
})
\ No newline at end of file
webpackHotUpdate("main",{
/***/ "./js/main.js":
/*!********************!*\
!*** ./js/main.js ***!
\********************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("var cb = function cb() {\n 'use strict';\n\n var l = document.createElement('link'),\n h = document.getElementsByTagName('head')[0]; // oldIE =document.all && !document.addEventListener;\n\n l.rel = 'stylesheet';\n l.href = '/wp-content/themes/biuro/css/main.min.css'; // l.href = (oldIE) ? 'mysite/css/main-fixed.css' : 'mysite/css/main-responsive.css';\n\n h.parentNode.insertBefore(l, h);\n},\n raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;\n\nif (raf) {\n raf(cb);\n} else {\n if (window.addEventListener) {\n window.addEventListener('load', cb);\n } else {\n window.attachEvent('onload', cb);\n }\n}\n\nvar container = document.getElementById('biuro-cookies-container'),\n agreed = useLocalStorage() ? localStorage.getItem('biuro-agree') : false;\n\nfunction useLocalStorage() {\n var mod = 'a';\n\n try {\n localStorage.setItem(mod, mod);\n localStorage.removeItem(mod);\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction biuroCookiesInitiate() {\n if (useLocalStorage()) {\n localStorage.setItem('biuro-agree', 'true');\n }\n\n biuroCookiesClose();\n}\n\nfunction biuroCookiesClose() {\n if (container) {\n container.style.display = 'none';\n }\n}\n\nif (!agreed && container) {\n container.style.display = 'block';\n}\n\nconsole.log('here goes main I'); // console.log('here goes main II');\n// console.log('here goes main III');\n\n//# sourceURL=webpack:///./js/main.js?");
/***/ })
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment