forked from kost/docker-alpine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial import of fundamental images
- Loading branch information
Showing
9 changed files
with
416 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM gliderlabs/alpine | ||
MAINTAINER kost - https://github.com/kost | ||
|
||
RUN apk --update add php-apache2 curl php-cli php-json php-phar php-openssl && rm -f /var/cache/apk/* && \ | ||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \ | ||
mkdir /app && chown -R apache:apache /app && \ | ||
sed -i 's#^DocumentRoot ".*#DocumentRoot "/app"#g' /etc/apache2/httpd.conf && \ | ||
sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf && \ | ||
echo "Success" | ||
|
||
ADD scripts/run.sh /scripts/run.sh | ||
RUN mkdir /scripts/pre-exec.d && \ | ||
mkdir /scripts/pre-init.d && \ | ||
chmod -R 755 /scripts | ||
|
||
EXPOSE 80 | ||
|
||
# VOLUME /app | ||
WORKDIR /app | ||
|
||
ENTRYPOINT ["/scripts/run.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# k0st/alpine-apache-app | ||
|
||
Multiple purpose Apache and PHP image based on Alpine | ||
|
||
Image is based on the [gliderlabs/alpine](https://registry.hub.docker.com/u/gliderlabs/alpine/) base image | ||
|
||
## Docker image size | ||
|
||
[![Latest](https://badge.imagelayers.io/k0st/alpine-apache-php.svg)](https://imagelayers.io/?images=k0st/alpine-apache-php:latest 'latest') | ||
|
||
## Docker image usage | ||
|
||
``` | ||
docker run [docker-options] k0st/alpine-apache-php | ||
``` | ||
|
||
## Examples | ||
|
||
Typical basic usage: | ||
|
||
``` | ||
docker run -it k0st/alpine-apache-php | ||
``` | ||
|
||
Typical usage in Dockerfile: | ||
|
||
``` | ||
FROM k0st/alpine-apache-php | ||
RUN echo "<?php phpinfo() ?>" > /app/index.php | ||
``` | ||
|
||
Typical usage: | ||
|
||
``` | ||
docker run -it --link=somedb:db k0st/alpine-apache-php | ||
``` | ||
|
||
### Todo | ||
- [ ] Check volume and data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
|
||
# execute any pre-init scripts, useful for images | ||
# based on this image | ||
for i in /scripts/pre-init.d/*sh | ||
do | ||
if [ -e "${i}" ]; then | ||
echo "[i] pre-init.d - processing $i" | ||
. "${i}" | ||
fi | ||
done | ||
|
||
# set apache as owner/group | ||
chown -R apache:apache /app | ||
|
||
# display logs | ||
tail -F /var/log/apache2/*log & | ||
|
||
# execute any pre-exec scripts, useful for images | ||
# based on this image | ||
for i in /scripts/pre-exec.d/*sh | ||
do | ||
if [ -e "${i}" ]; then | ||
echo "[i] pre-exec.d - processing $i" | ||
. "${i}" | ||
fi | ||
done | ||
|
||
echo "[i] Starting daemon..." | ||
# run apache httpd daemon | ||
httpd -D FOREGROUND |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM gliderlabs/alpine | ||
MAINTAINER kost - https://github.com/kost | ||
|
||
RUN apk --update add mysql mysql-client pwgen && rm -f /var/cache/apk/* && \ | ||
echo "Success" | ||
|
||
ADD scripts/run.sh /scripts/run.sh | ||
RUN mkdir /scripts/pre-exec.d && \ | ||
mkdir /scripts/pre-init.d && \ | ||
chmod -R 755 /scripts | ||
|
||
# EXPOSE 3306 | ||
# WORKDIR /app | ||
|
||
VOLUME ["/var/lib/mysql"] | ||
|
||
ENTRYPOINT ["/scripts/run.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# k0st/alpine-mariadb | ||
|
||
Multiple purpose MariaDB/MySQL based on Alpine | ||
|
||
Image is based on the [gliderlabs/alpine](https://registry.hub.docker.com/u/gliderlabs/alpine/) base image | ||
|
||
## Docker image size | ||
|
||
[![Latest](https://badge.imagelayers.io/k0st/alpine-mariadb.svg)](https://imagelayers.io/?images=k0st/alpine-mariadb:latest 'latest') | ||
|
||
## Docker image usage | ||
|
||
``` | ||
docker run [docker-options] k0st/alpine-mariadb | ||
``` | ||
|
||
Note that MySQL root will be randomly generated (using pwgen). | ||
Root password will be displayed, during first run using output similar to this: | ||
``` | ||
[i] MySQL root Password: XXXXXXXXXXXXXXX | ||
``` | ||
|
||
But you don't need root password really. If you connect locally, it should not | ||
ask you for password, so you can use following procedure: | ||
``` | ||
docker exec -it mariadb_containerid /bin/sh | ||
# mysql -u root mysql | ||
``` | ||
|
||
## Examples | ||
|
||
Typical usage: | ||
|
||
``` | ||
docker run -it -v /host/dir/for/db:/var/lib/mysql -e MYSQL_DATABASE=db -e MYSQL_USER=user -e MYSQL_PASSWORD=blah k0st/alpine-mariadb | ||
``` | ||
|
||
### Todo | ||
- [ ] Check volume and data | ||
- [ ] Provide more examples | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/sh | ||
|
||
# execute any pre-init scripts, useful for images | ||
# based on this image | ||
for i in /scripts/pre-init.d/*sh | ||
do | ||
if [ -e "${i}" ]; then | ||
echo "[i] pre-init.d - processing $i" | ||
. "${i}" | ||
fi | ||
done | ||
|
||
if [ -d /var/lib/mysql/mysql ]; then | ||
echo "[i] MySQL directory already present, skipping creation" | ||
else | ||
echo "[i] MySQL data directory not found, creating initial DBs" | ||
|
||
chown -R mysql:mysql /var/lib/mysql | ||
|
||
mysql_install_db --user=mysql > /dev/null | ||
|
||
if [ "$MYSQL_ROOT_PASSWORD" = "" ]; then | ||
MYSQL_ROOT_PASSWORD=`pwgen 16 1` | ||
echo "[i] MySQL root Password: $MYSQL_ROOT_PASSWORD" | ||
fi | ||
|
||
MYSQL_DATABASE=${MYSQL_DATABASE:-""} | ||
MYSQL_USER=${MYSQL_USER:-""} | ||
MYSQL_PASSWORD=${MYSQL_PASSWORD:-""} | ||
|
||
if [ ! -d "/run/mysqld" ]; then | ||
mkdir -p /run/mysqld | ||
chown -R mysql:mysql /run/mysqld | ||
fi | ||
|
||
tfile=`mktemp` | ||
if [ ! -f "$tfile" ]; then | ||
return 1 | ||
fi | ||
|
||
cat << EOF > $tfile | ||
USE mysql; | ||
FLUSH PRIVILEGES; | ||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; | ||
UPDATE user SET password=PASSWORD("$MYSQL_ROOT_PASSWORD") WHERE user='root'; | ||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; | ||
UPDATE user SET password=PASSWORD("") WHERE user='root' AND host='localhost'; | ||
EOF | ||
|
||
if [ "$MYSQL_DATABASE" != "" ]; then | ||
echo "[i] Creating database: $MYSQL_DATABASE" | ||
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile | ||
|
||
if [ "$MYSQL_USER" != "" ]; then | ||
echo "[i] Creating user: $MYSQL_USER with password $MYSQL_PASSWORD" | ||
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile | ||
fi | ||
fi | ||
|
||
/usr/bin/mysqld --user=mysql --bootstrap --verbose=0 < $tfile | ||
rm -f $tfile | ||
fi | ||
|
||
# execute any pre-exec scripts, useful for images | ||
# based on this image | ||
for i in /scripts/pre-exec.d/*sh | ||
do | ||
if [ -e "${i}" ]; then | ||
echo "[i] pre-exec.d - processing $i" | ||
. ${i} | ||
fi | ||
done | ||
|
||
exec /usr/bin/mysqld --user=mysql --console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM gliderlabs/alpine | ||
MAINTAINER kost - https://github.com/kost | ||
|
||
RUN apk --update add postgresql openssl && rm -f /var/cache/apk/* && \ | ||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.4/gosu-amd64" && \ | ||
chmod +x /usr/local/bin/gosu && \ | ||
echo "Success" | ||
|
||
ADD scripts/run.sh /scripts/run.sh | ||
RUN mkdir /scripts/pre-exec.d && \ | ||
mkdir /scripts/pre-init.d && \ | ||
chmod -R 755 /scripts | ||
|
||
ENV LANG en_US.utf8 | ||
ENV PGDATA /var/lib/postgresql/data | ||
VOLUME ["/var/lib/postgresql/data"] | ||
|
||
ENTRYPOINT ["/scripts/run.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# k0st/alpine-postgres | ||
|
||
Multiple purpose PostgreSQL database based on Alpine | ||
|
||
Image is based on the [gliderlabs/alpine](https://registry.hub.docker.com/u/gliderlabs/alpine/) base image | ||
|
||
## Docker image size | ||
|
||
[![Latest](https://badge.imagelayers.io/k0st/alpine-postgres.svg)](https://imagelayers.io/?images=k0st/alpine-postgres:latest 'latest') | ||
|
||
## Docker image usage | ||
|
||
``` | ||
docker run [docker-options] k0st/alpine-postgres | ||
``` | ||
|
||
## Variables | ||
|
||
Following environment variables will be used when running: | ||
|
||
### Standard | ||
|
||
`PGDATA` - location of PostgreSQL database files (default: /var/lib/postgresql/data) | ||
`POSTGRES_USER` - PostgreSQL username (if not specified: postgres) | ||
`POSTGRES_PASSWORD` - PostgreSQL password (if not specified: empty) | ||
|
||
### Specific to this image | ||
|
||
`POSTGRES_DB` - PostgreSQL database name (if not specified: same as `POSTGRES_USER`) | ||
`POSTGRES_FIX_OWNERSHIP` - PostgreSQL fix ownership of PGDATA | ||
|
||
|
||
## Remarks | ||
|
||
Note that if you don't specify any POSTGRES environment parameters, | ||
postgres will listen on all interfaces with ALL privileges as postgres | ||
user. | ||
|
||
You just need to minimaly specify `POSTGRES_USER` as env variable in | ||
order to create PostgreSQL database with same name. Password will be | ||
empty. | ||
|
||
By default, only permissions to access `POSTGRES_DB` is given to | ||
`POSTGRES_USER`. No SUPERUSER permissions will be given. | ||
|
||
But you don't need SUPERUSER permissions really. If you connect locally, | ||
it should not ask you for password, so you can use following procedure: | ||
|
||
``` | ||
docker exec -it postgres_containerid /bin/sh | ||
# gosu postgres psql | ||
``` | ||
|
||
Only if nothing is specified, user postgres will | ||
have SUPERUSER privileges with access allowed from all hosts. | ||
|
||
## Examples | ||
|
||
Quick testing (you can connect to this host from any hosts with username postgres): | ||
|
||
``` | ||
docker run -it --rm k0st/alpine-postgres | ||
``` | ||
|
||
Typical usage, create user test and database test: | ||
|
||
``` | ||
docker run -it -v /host/dir/for/db:/var/lib/postgresql/data -e POSTGRES_USER=test k0st/alpine-postgres | ||
``` | ||
|
||
Typical usage, create user test with password Passw0rd and database testdb | ||
``` | ||
docker run -it -v /host/dir/for/db:/var/lib/postgresql/data -e POSTGRES_USER=test -e POSTGRES_PASSWORD=Passw0rd -e POSTGRES_DB=testdb k0st/alpine-postgres | ||
``` | ||
|
||
### Todo | ||
- [ ] Provide more examples | ||
|
Oops, something went wrong.