From 917103ddbb6ec1fb2b08e52923fe93f6372eca93 Mon Sep 17 00:00:00 2001 From: Bao Nguyen Tran Date: Mon, 31 Jul 2023 17:25:14 +0700 Subject: [PATCH] [DOPS-2632] Add a command to install tini in alpine image (#31) * [DOPS-2632] Add a command to install tini in alpine image * [DOPS-2632] Add a command to install tini in alpine image * [DOPS-2632] Add a command to install tini in alpine image * [DOPS-2632] Add a command to install tini in alpine image --- .../soramitsu/devops/docker/DockerPlugin.groovy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/groovy/jp/co/soramitsu/devops/docker/DockerPlugin.groovy b/src/main/groovy/jp/co/soramitsu/devops/docker/DockerPlugin.groovy index b26d672..f129d1d 100644 --- a/src/main/groovy/jp/co/soramitsu/devops/docker/DockerPlugin.groovy +++ b/src/main/groovy/jp/co/soramitsu/devops/docker/DockerPlugin.groovy @@ -209,22 +209,22 @@ class DockerPlugin implements Plugin { // copy jar t.copyFile jar.name, "/${jar.name}" - // setup tiny https://github.com/krallin/tini - t.addFile "https://github.com/krallin/tini/releases/download/v0.19.0/tini", "/tini" - t.runCommand "chmod +x /tini" - t.entryPoint "/tini", "--" - // add user def command = "docker run -t --rm ${dockerConfig.baseImage} cat /etc/os-release" def content = ["sh", "-c", command].execute().text def groupCommand = "" if (content.contains("alpine")) { - groupCommand = "addgroup -S appuser && adduser -S -G appuser appuser" + // setup tiny https://github.com/krallin/tini + t.runCommand "apk add --no-cache tini" + t.runCommand "addgroup -S appuser && adduser -S -G appuser appuser" } else { - groupCommand = "groupadd -r appuser && useradd -r -g appuser appuser" + // setup tiny https://github.com/krallin/tini + t.addFile "https://github.com/krallin/tini/releases/download/v0.19.0/tini", "/sbin/tini" + t.runCommand "chmod +x /sbin/tini" + t.runCommand "groupadd -r appuser && useradd -r -g appuser appuser" } - t.runCommand groupCommand + t.entryPoint "tini", "--" t.instruction "USER appuser" // if null, then use empty string