From 61958699cd09e1aa445f439793c4f63a3d583eaf Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Wed, 14 Jul 2021 18:06:46 +0700 Subject: [PATCH] Task: Add docker from cubetiq docker image and replaced docker container --- Dockerfile | 4 ++-- entrypoint.sh | 16 ++++------------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index cb90a71..bc8e7e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM docker:latest +FROM cubetiq/calpine-docker:latest -RUN apk add bash +RUN apk update COPY ./entrypoint.sh /entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh index f92525d..648ac7a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,8 +1,8 @@ -#!/bin/bash +#!/bin/sh #### Current working directory is: /github/workspace #### WORKDIR=$(pwd) -echo "Workdir => ${WORKDIR}" +echo "Working directory => $WORKDIR" if [ ! -z $INPUT_USERNAME ]; then echo $INPUT_PASSWORD | docker login $INPUT_REGISTRY -u $INPUT_USERNAME --password-stdin @@ -15,7 +15,7 @@ then INPUT_OPTIONS="$INPUT_OPTIONS --network $INPUT_DOCKER_NETWORK" fi if [ -z $INPUT_SHELL ]; -then INPUT_SHELL=sh +then INPUT_SHELL=/bin/sh fi if [ -z $INPUT_IMAGE ]; @@ -26,12 +26,4 @@ if [ -z $semicolon_delimited_script ]; then semicolon_delimited_script="echo $(whoami)" fi -echo "My name is: $(whoami)" - -echo "Start executing docker..." - -mkdir hello - -echo "Hello World" > hello/hello.txt - -docker run --workdir /github/workspace -v "$(pwd)":"/github/workspace" -v "/var/run/docker.sock":"/var/run/docker.sock" --entrypoint=sh $INPUT_IMAGE -c "docker version; docker ps; pwd; ls; ls /" \ No newline at end of file +exec docker run --workdir $WORKDIR -v "$WORKDIR":"$WORKDIR" -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" \ No newline at end of file