adding pluie/alpine based image
This commit is contained in:
parent
51cb56d4d0
commit
010ae4c1db
1
pluie/alpine/.gitignore
vendored
Normal file
1
pluie/alpine/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
files.tar
|
11
pluie/alpine/Dockerfile
Normal file
11
pluie/alpine/Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
FROM gliderlabs/alpine:3.2
|
||||||
|
|
||||||
|
MAINTAINER a-Sansara https://github.com/a-sansara
|
||||||
|
|
||||||
|
ADD files.tar /scripts
|
||||||
|
|
||||||
|
RUN apk --update add bash && bash /scripts/install.sh
|
||||||
|
|
||||||
|
ENV TERM=xterm HTTP_SERVER_NAME=docker-site.dev FIX_OWNERSHIP=1
|
||||||
|
|
||||||
|
ENTRYPOINT ["/scripts/main.sh"]
|
61
pluie/alpine/README.md
Normal file
61
pluie/alpine/README.md
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# pluie/alpine
|
||||||
|
|
||||||
|
This Image provide a Linux Alpine distribution with fully functionnal & colorized terminal, bash, curl & nano as editor
|
||||||
|
Base image [gliderlabs/alpine:3.2] (https://registry.hub.docker.com/u/gliderlabs/alpine/)
|
||||||
|
This project come with a structure to facilitate further images (like pluie/alpine-apache & pluie/alpine-mysql)
|
||||||
|
|
||||||
|
## Docker image size
|
||||||
|
|
||||||
|
- very small image < 10 MB
|
||||||
|
|
||||||
|
|
||||||
|
## Docker image usage
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker run --name alpine pluie/alpine
|
||||||
|
```
|
||||||
|
|
||||||
|
## Docker image structure
|
||||||
|
|
||||||
|
```
|
||||||
|
project/
|
||||||
|
|
|
||||||
|
|-- install.d/ # deployed in /scripts on target container
|
||||||
|
| | # launch on docker image building process
|
||||||
|
| | # XX-name.sh - low XX are run first
|
||||||
|
| |-- 00-util.sh
|
||||||
|
| |-- 40-fix.sh
|
||||||
|
|
|
||||||
|
|-- pre-init.d/ # deployed in /scripts on target container
|
||||||
|
| | # launch on docker container running process
|
||||||
|
| |-- 50-example.sh
|
||||||
|
|
|
||||||
|
|-- build # build docker image : ./build [TAG]
|
||||||
|
|-- common.sh # don't modify - sourced by main.sh to execute pre-init.d scripts first
|
||||||
|
|-- install.sh # don't modify - execute install.d scripts on docker building process
|
||||||
|
|-- main.sh # source common.sh then execute entry point instruction
|
||||||
|
|-- util.sh # sourced by common.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
you can easily create your own images based on this structure.
|
||||||
|
keep an eye to pluie/alpine-apache & pluie/alpine-mysql wich extend pluie/alpine
|
||||||
|
|
||||||
|
|
||||||
|
## Extend pluie/alpine Image
|
||||||
|
|
||||||
|
RUN instructions are minimized
|
||||||
|
on extended image you can only use :
|
||||||
|
```
|
||||||
|
RUN bash /scripts/install.sh
|
||||||
|
```
|
||||||
|
add your packages in a script in install.d directory
|
||||||
|
keep name below 40 because install.d/40-fix.sh clean package repository
|
||||||
|
each extended image inherit install.d && pre-init.d scripts
|
||||||
|
|
||||||
|
UNIQ ENTRYPOINT - extended images doesn't need to define ENTRYPOINT
|
||||||
|
you can keep intact build script in each extended project
|
||||||
|
manage your install & init instruction in install.d & pre-init.d directory
|
||||||
|
and write your own main.sh script
|
||||||
|
|
||||||
|
|
||||||
|
|
17
pluie/alpine/build
Executable file
17
pluie/alpine/build
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
|
||||||
|
|
||||||
|
Ctitle="\033[1;38;5;15;1;48;5;30m"
|
||||||
|
Citem="\033[1;38;5;36m"
|
||||||
|
Coff="\033[m"
|
||||||
|
DOCKBUILD=$(dirname "${BASH_SOURCE[0]}")
|
||||||
|
DOCKREPO=$(dirname "${DOCKBUILD}")
|
||||||
|
DOCKTAG=${1:-"latest"}
|
||||||
|
indent=" "
|
||||||
|
echo -e "\n ${Ctitle} Preparing files : ${Coff}${Citem}\n"
|
||||||
|
|
||||||
|
tar -cvf files.tar *.sh pre-init.d/ install.d/ | sed 's/^/${indent}* /'
|
||||||
|
|
||||||
|
echo -e "\n ${Ctitle} Proceed Dockerfile build : ${Coff}\n
|
||||||
|
"
|
||||||
|
docker build --force-rm -t ${DOCKREPO}/${DOCKBUILD}:${DOCKTAG} . | sed 's/^/${indent}/'
|
9
pluie/alpine/common.sh
Normal file
9
pluie/alpine/common.sh
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
|
||||||
|
|
||||||
|
. /scripts/util.sh
|
||||||
|
|
||||||
|
# execute any pre-init scripts wich is useful for images based on this image
|
||||||
|
# /scripts/pre-init.d/XX-name.sh
|
||||||
|
# low XX are run first
|
||||||
|
preInit "/scripts/pre-init.d"
|
3
pluie/alpine/install.d/00-util.sh
Executable file
3
pluie/alpine/install.d/00-util.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
apk --update add nano curl
|
3
pluie/alpine/install.d/40-fix.sh
Executable file
3
pluie/alpine/install.d/40-fix.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
rm -f /var/cache/apk/*
|
5
pluie/alpine/install.sh
Executable file
5
pluie/alpine/install.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
|
||||||
|
|
||||||
|
. /scripts/util.sh
|
||||||
|
preInit "/scripts/install.d"
|
5
pluie/alpine/main.sh
Executable file
5
pluie/alpine/main.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
|
||||||
|
|
||||||
|
. /scripts/common.sh
|
||||||
|
bash
|
4
pluie/alpine/pre-init.d/50-example.sh
Executable file
4
pluie/alpine/pre-init.d/50-example.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ls -la /scripts
|
||||||
|
chown -R root:root /scripts/
|
12
pluie/alpine/util.sh
Executable file
12
pluie/alpine/util.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
|
||||||
|
|
||||||
|
function preInit(){
|
||||||
|
for i in ls $1/*.sh
|
||||||
|
do
|
||||||
|
if [ -e "${i}" ]; then
|
||||||
|
echo "[[ Processing $i ]]"
|
||||||
|
. "${i}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user