File: docker.sh

package info (click to toggle)
libreswan 5.2-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 81,632 kB
  • sloc: ansic: 129,988; sh: 32,018; xml: 20,646; python: 10,303; makefile: 3,022; javascript: 1,506; sed: 574; yacc: 511; perl: 264; awk: 52
file content (34 lines) | stat: -rw-r--r-- 624 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

set -e

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BASE="$(basename "$0")"

cd "$DIR"

if [ "$1" != "build" ] && \
   [ "$1" != "pull" ] && \
   [ "$1" != "push" ] && \
   [ "$1" != "list" ]; then
  echo -e "Usage: $BASE arg\n" \
          "arg should be build, pull, push or list"  >&2
  exit 1
fi

for dir in */*; do
  DOCIMG=$(printf "$dir\n" | sed 's#/##' | sed 's#^#curtine/libreswan:#')

  if [ "$1" == "build" ]; then
    /bin/bash -c "cd $dir && docker build -t $DOCIMG ."
    continue
  fi

  if [ "$1" == "list" ]; then
    printf "$DOCIMG\n"
    continue
  fi

  docker "$1" "$DOCIMG"
done