Browse Source

Add reveal dockerfile

drymer 1 year ago
parent
commit
13bd9dc77e
Signed by: drymer <drymer@autistici.org> GPG Key ID: A307D64D5DDFDAAD
7 changed files with 43 additions and 10 deletions
  1. 1
    1
      ansible/Dockerfile_2.4
  2. 1
    1
      ansible/Dockerfile_2.5
  3. 11
    7
      buildAndPush.sh
  4. 6
    0
      reveal/Dockerfile
  5. 15
    0
      reveal/README.md
  6. 8
    0
      reveal/entrypoint.sh
  7. 1
    1
      tox/Dockerfile

+ 1
- 1
ansible/Dockerfile_2.4 View File

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

+ 1
- 1
ansible/Dockerfile_2.5 View File

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

+ 11
- 7
buildAndPush.sh View File

@@ -3,23 +3,27 @@
3 3
 set -e
4 4
 set -o pipefail
5 5
 
6
-files="$(git diff HEAD~ --name-only -- '*Dockerfile*')"
7
-write_registry="r.daemons.it"
6
+FILES="$(git diff HEAD~ --name-only -- '*Dockerfile*')"
7
+WRITE_REGISTRY="r.daemons.it"
8 8
 
9
-for file in $files
9
+for file in $FILES
10 10
 do
11 11
     dockerfile="$(echo "$file" | sed 's/.*\///')"
12 12
     docker_name="$(echo "$file" | sed 's/\/.*//')"
13 13
     tag="$(echo "$dockerfile" | sed 's/.*_//')"
14 14
 
15
+    if [ "$(grep -q 'as production' $file)" ]
16
+    then
17
+        stage_target="--target production"
18
+    fi
15 19
     cd "$docker_name"
16 20
     # Asume that when using multiple stages, the good one is the one called
17 21
     # production
18
-    docker build --target production -t "$write_registry/$docker_name:$tag" -t \
19
-        "$write_registry/$docker_name:latest" -f "$dockerfile" .
22
+    docker build $stage_target -t "$WRITE_REGISTRY/$docker_name:$tag" -t \
23
+        "$WRITE_REGISTRY/$docker_name:latest" -f "$dockerfile" .
20 24
     echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin r.daemons.it
21
-    docker push "$write_registry/$docker_name:$tag"
22
-    docker push "$write_registry/$docker_name:latest"
25
+    docker push "$WRITE_REGISTRY/$docker_name:$tag"
26
+    docker push "$WRITE_REGISTRY/$docker_name:latest"
23 27
     cd ..
24 28
 done
25 29
 

+ 6
- 0
reveal/Dockerfile View File

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

+ 15
- 0
reveal/README.md View File

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

+ 8
- 0
reveal/entrypoint.sh View File

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

+ 1
- 1
tox/Dockerfile View File

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

Loading…
Cancel
Save