File tree Expand file tree Collapse file tree 7 files changed +45
-18
lines changed Expand file tree Collapse file tree 7 files changed +45
-18
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,17 @@ YELLOW='\E[1;33m'
10
10
11
11
export BLUE CYAN GREEN RED RESET YELLOW
12
12
13
+ # Identify docker-like command
14
+ # Ensure docker exists
15
+ if command -v docker 1> /dev/null 2>&1 ; then
16
+ export docker=docker
17
+ elif command -v podman 1> /dev/null 2>&1 ; then
18
+ export docker=podman
19
+ else
20
+ echo -e " ${RED} ❯ docker or podman command is not available${RESET} "
21
+ exit 1
22
+ fi
23
+
13
24
# Docker Compose
14
25
COMPOSE_PROJECT_NAME=" npmdev"
15
26
COMPOSE_FILE=" docker/docker-compose.dev.yml"
Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ if [ "$BUILD_COMMIT" == "" ]; then
14
14
fi
15
15
16
16
# Buildx Builder
17
- docker buildx create --name " ${BUILDX_NAME:- npm} " || echo
18
- docker buildx use " ${BUILDX_NAME:- npm} "
17
+ $ docker buildx create --name " ${BUILDX_NAME:- npm} " || echo
18
+ $ docker buildx use " ${BUILDX_NAME:- npm} "
19
19
20
- docker buildx build \
20
+ $ docker buildx build \
21
21
--build-arg BUILD_VERSION=" ${BUILD_VERSION:- dev} " \
22
22
--build-arg BUILD_COMMIT=" ${BUILD_COMMIT:- notset} " \
23
23
--build-arg BUILD_DATE=" $( date ' +%Y-%m-%d %T %Z' ) " \
@@ -31,6 +31,6 @@ docker buildx build \
31
31
.
32
32
33
33
rc=$?
34
- docker buildx rm " ${BUILDX_NAME:- npm} "
34
+ $ docker buildx rm " ${BUILDX_NAME:- npm} "
35
35
echo -e " ${BLUE} ❯ ${GREEN} Multiarch build Complete${RESET} "
36
36
exit $rc
Original file line number Diff line number Diff line change @@ -6,12 +6,17 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
6
DOCKER_IMAGE=jc21/nginx-full:certbot-node
7
7
8
8
# Ensure docker exists
9
- if hash docker 2> /dev/null; then
10
- docker pull " ${DOCKER_IMAGE} "
11
- cd " ${DIR} /../.."
12
- echo -e " ${BLUE} ❯ ${CYAN} Building Frontend ...${RESET} "
13
- docker run --rm -e CI=true -v " $( pwd) /frontend:/app/frontend" -v " $( pwd) /global:/app/global" -w /app/frontend " $DOCKER_IMAGE " sh -c " yarn install && yarn build && yarn build && chown -R $( id -u) :$( id -g) /app/frontend"
14
- echo -e " ${BLUE} ❯ ${GREEN} Building Frontend Complete${RESET} "
9
+ if command -v docker 1> /dev/null 2>&1 ; then
10
+ docker=docker
11
+ elif command -v podman 1> /dev/null 2>&1 ; then
12
+ docker=podman
15
13
else
16
- echo -e " ${RED} ❯ docker command is not available${RESET} "
14
+ echo -e " ${RED} ❯ docker or podman command is not available${RESET} "
15
+ exit 1
17
16
fi
17
+
18
+ $docker pull " ${DOCKER_IMAGE} "
19
+ cd " ${DIR} /../.."
20
+ echo -e " ${BLUE} ❯ ${CYAN} Building Frontend ...${RESET} "
21
+ $docker run --rm -e CI=true -v " $( pwd) /frontend:/app/frontend" -v " $( pwd) /global:/app/global" -w /app/frontend " $DOCKER_IMAGE " sh -c " yarn install && yarn build && yarn build && chown -R $( id -u) :$( id -g) /app/frontend"
22
+ echo -e " ${BLUE} ❯ ${GREEN} Building Frontend Complete${RESET} "
Original file line number Diff line number Diff line change 1
1
#! /bin/bash -e
2
2
3
3
DOCKER_IMAGE=jc21/nginx-full:certbot-node
4
- docker pull " ${DOCKER_IMAGE} "
4
+
5
+ # Ensure docker exists
6
+ if command -v docker 1> /dev/null 2>&1 ; then
7
+ docker=docker
8
+ elif command -v podman 1> /dev/null 2>&1 ; then
9
+ docker=podman
10
+ else
11
+ echo -e " ${RED} ❯ docker or podman command is not available${RESET} "
12
+ exit 1
13
+ fi
14
+
15
+ $docker pull " ${DOCKER_IMAGE} "
5
16
6
17
# Test
7
- docker run --rm \
18
+ $ docker run --rm \
8
19
-v " $( pwd) /backend:/app" \
9
20
-v " $( pwd) /global:/app/global" \
10
21
-w /app \
11
22
" ${DOCKER_IMAGE} " \
12
23
sh -c ' yarn install && yarn eslint . && rm -rf node_modules'
13
24
14
25
# Build
15
- docker build --pull --no-cache --squash --compress \
26
+ $ docker build --pull --no-cache --squash --compress \
16
27
-t " ${IMAGE} :ci-${BUILD_NUMBER} " \
17
28
-f docker/Dockerfile \
18
29
--build-arg TARGETPLATFORM=linux/amd64 \
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
7
if hash docker 2> /dev/null; then
8
8
cd " ${DIR} /.."
9
9
echo -e " ${BLUE} ❯ ${CYAN} Building Docs ...${RESET} "
10
- docker run --rm -e CI=true -v " $( pwd) /docs:/app/docs" -w /app/docs node:alpine sh -c " yarn install && yarn build && chown -R $( id -u) :$( id -g) /app/docs"
10
+ $ docker run --rm -e CI=true -v " $( pwd) /docs:/app/docs" -w /app/docs node:alpine sh -c " yarn install && yarn build && chown -R $( id -u) :$( id -g) /app/docs"
11
11
echo -e " ${BLUE} ❯ ${GREEN} Building Docs Complete${RESET} "
12
12
else
13
13
echo -e " ${RED} ❯ docker command is not available${RESET} "
Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ if hash docker-compose 2>/dev/null; then
18
18
19
19
if [ " $1 " == " -f" ]; then
20
20
echo -e " ${BLUE} ❯ ${YELLOW} Following Backend Container:${RESET} "
21
- docker logs -f npm_core
21
+ $ docker logs -f npm_core
22
22
else
23
23
echo -e " ${YELLOW} Hint:${RESET} You can follow the output of some of the containers with:"
24
- echo " docker logs -f npm_core"
24
+ echo " $ docker logs -f npm_core"
25
25
fi
26
26
else
27
27
echo -e " ${RED} ❯ docker-compose command is not available${RESET} "
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ echo -e "${BLUE}❯ ${CYAN}Waiting for healthy: ${YELLOW}${SERVICE}${RESET}"
19
19
until [ " ${HEALTHY} " = " healthy" ]; do
20
20
echo -n " ."
21
21
sleep 1
22
- HEALTHY=" $( docker inspect -f ' {{.State.Health.Status}}' $SERVICE ) "
22
+ HEALTHY=" $( $ docker inspect -f ' {{.State.Health.Status}}' $SERVICE ) "
23
23
(( LOOPCOUNT++ ))
24
24
25
25
if [ " $LOOPCOUNT " == " $LIMIT " ]; then
You can’t perform that action at this time.
0 commit comments