Add reveal dockerfile

This commit is contained in:
drymer 2018-07-22 19:38:43 +02:00
parent 275fa015d5
commit 13bd9dc77e
Signed by: drymer
GPG Key ID: A307D64D5DDFDAAD
7 changed files with 43 additions and 10 deletions

View File

@ -4,7 +4,7 @@ RUN mkdir -p /var/cache/apk && ln -s /var/cache/apk /etc/apk/cache && apk add \
--update py2-pip gcc musl-dev python-dev libffi-dev openssl-dev make
RUN pip install wheel && pip wheel --wheel-dir=/root/wheel ansible==2.4 docker-py
FROM alpine:3.7 as production
FROM alpine:3.7
COPY --from=builder /root/wheel /root/wheel
COPY --from=builder /root/.cache /root/.cache
COPY --from=builder /etc/apk/cache /etc/apk/cache

View File

@ -4,7 +4,7 @@ RUN mkdir -p /var/cache/apk && ln -s /var/cache/apk /etc/apk/cache && apk add \
--update py2-pip gcc musl-dev python-dev libffi-dev openssl-dev make
RUN pip install wheel && pip wheel --wheel-dir=/root/wheel ansible==2.5 docker-py
FROM alpine:3.7 as production
FROM alpine:3.7
COPY --from=builder /root/wheel /root/wheel
COPY --from=builder /root/.cache /root/.cache
COPY --from=builder /etc/apk/cache /etc/apk/cache

View File

@ -3,23 +3,27 @@
set -e
set -o pipefail
files="$(git diff HEAD~ --name-only -- '*Dockerfile*')"
write_registry="r.daemons.it"
FILES="$(git diff HEAD~ --name-only -- '*Dockerfile*')"
WRITE_REGISTRY="r.daemons.it"
for file in $files
for file in $FILES
do
dockerfile="$(echo "$file" | sed 's/.*\///')"
docker_name="$(echo "$file" | sed 's/\/.*//')"
tag="$(echo "$dockerfile" | sed 's/.*_//')"
if [ "$(grep -q 'as production' $file)" ]
then
stage_target="--target production"
fi
cd "$docker_name"
# Asume that when using multiple stages, the good one is the one called
# production
docker build --target production -t "$write_registry/$docker_name:$tag" -t \
"$write_registry/$docker_name:latest" -f "$dockerfile" .
docker build $stage_target -t "$WRITE_REGISTRY/$docker_name:$tag" -t \
"$WRITE_REGISTRY/$docker_name:latest" -f "$dockerfile" .
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin r.daemons.it
docker push "$write_registry/$docker_name:$tag"
docker push "$write_registry/$docker_name:latest"
docker push "$WRITE_REGISTRY/$docker_name:$tag"
docker push "$WRITE_REGISTRY/$docker_name:latest"
cd ..
done

6
reveal/Dockerfile Normal file
View File

@ -0,0 +1,6 @@
FROM node:6
RUN npm install -g grunt-cli && apt update && apt install git --no-install-recommends -y
WORKDIR /revealjs
RUN git clone https://github.com/hakimel/reveal.js.git /revealjs && npm install && mkdir files
COPY entrypoint.sh /revealjs
ENTRYPOINT ["./entrypoint.sh"]

15
reveal/README.md Normal file
View File

@ -0,0 +1,15 @@
# Reveal.js
With this image you avoid installing npm, which is always nice. This image will
expect to find your reveal files at `/revealjs/files`. You may use this image
with the next function:
``` bash
reveal () {
async () {
sleep 3 && xdg-open http:localhost:8000
}
async &|
docker run -ti --name revealjs --rm -v `pwd`:/revealjs/files/ -p 8000:8000 revealjs
}
```

8
reveal/entrypoint.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
for file in `ls files`
do
ln -sf files/$file $file
done
npm start

View File

@ -28,7 +28,7 @@ RUN . ~/.bash_profile && pyenv install 3.5.5
RUN . ~/.bash_profile && pyenv install 3.6.6
RUN . ~/.bash_profile && pyenv install 3.7.0
FROM debian:stretch-slim as production
FROM debian:stretch-slim
COPY --from=builder /root/.pyenv/ /root/.pyenv/
COPY --from=builder /root/.bash_profile/ /root/.bash_profile