diff --git a/ci-runner/Dockerfile b/ci-runner/Dockerfile index 559d28da9..d516493ec 100644 --- a/ci-runner/Dockerfile +++ b/ci-runner/Dockerfile @@ -1,38 +1,46 @@ -####-------------- FROM golang:1.21-alpine3.18 AS build-env -RUN apk add --no-cache git gcc musl-dev -RUN apk add --update make +RUN apk add --no-cache git gcc musl-dev && \ + apk add --update make WORKDIR /go/src/github.com/devtron-labs/cirunner -ADD . /go/src/github.com/devtron-labs/cirunner/ + +# ADD . /go/src/github.com/devtron-labs/cirunner/ COPY . . + # Build the binary RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -a -installsuffix cgo -o /go/bin/cirunner FROM docker:20.10.24-dind # All these steps will be cached #RUN apk add --no-cache ca-certificates -RUN apk update && apk add --no-cache --virtual .build-deps && apk add bash && apk add make && apk add curl && apk add git && apk add zip && apk add jq -RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime -RUN apk -Uuv add groff less python3 py3-pip -RUN pip3 install awscli -RUN apk --purge -v del py-pip -RUN rm /var/cache/apk/* + +RUN apk update && apk add --no-cache --virtual .build-deps && apk add bash && apk add make && apk add curl && apk add git && apk add zip && apk add jq && \ + ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ + apk -Uuv add groff less python3 py3-pip && \ + pip3 install awscli && \ + apk --purge -v del py-pip && \ + rm /var/cache/apk/* + COPY --from=docker/compose:latest /usr/local/bin/docker-compose /usr/bin/docker-compose -COPY ./buildpack.json /buildpack.json -COPY ./git-ask-pass.sh /git-ask-pass.sh -RUN chmod +x /git-ask-pass.sh +COPY ./buildpack.json ./git-ask-pass.sh / +# COPY ./git-ask-pass.sh /git-ask-pass.sh -RUN (curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack) +RUN chmod +x /git-ask-pass.sh && \ + (curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack) COPY --from=build-env /go/bin/cirunner . + COPY ./ssh-config /root/.ssh/config -RUN chmod 644 /root/.ssh/config -RUN mkdir -p /etc/docker + +RUN chmod 644 /root/.ssh/config && \ + mkdir -p /etc/docker && \ + mkdir -p /root/.docker/buildx + COPY docker-daemon.json /etc/docker/daemon.json -RUN mkdir -p /root/.docker/buildx + + COPY buildkitd.default.toml /root/.docker/buildx/buildkitd.default.toml # passing PARENT_MODE as argument to cirunner as default behavior diff --git a/ci-runner/Dockerfile-v27 b/ci-runner/Dockerfile-v27 index d7c49cfaf..b0bb45d09 100644 --- a/ci-runner/Dockerfile-v27 +++ b/ci-runner/Dockerfile-v27 @@ -1,11 +1,12 @@ -####-------------- FROM golang:1.21-alpine3.18 AS build-env -RUN apk add --no-cache git gcc musl-dev -RUN apk add --update make +RUN apk add --no-cache git gcc musl-dev && \ + apk add --update make WORKDIR /go/src/github.com/devtron-labs/cirunner + ADD . /go/src/github.com/devtron-labs/cirunner/ + COPY . . # Build the binary RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -a -installsuffix cgo -o /go/bin/cirunner @@ -14,24 +15,26 @@ RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -a -installsuffix cgo -o / FROM docker:27.3-dind # All these steps will be cached #RUN apk add --no-cache ca-certificates + RUN apk update && apk add --no-cache --virtual .build-deps && apk add bash && apk add make && apk add curl && apk add git && apk add zip && apk add jq -RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime -RUN apk -Uuv add groff less python3 py3-pip pipx -RUN pipx ensurepath && pipx install awscli -RUN cp /root/.local/bin/aws* /usr/local/bin -RUN apk --purge -v del py-pip -RUN rm /var/cache/apk/* + ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ + apk -Uuv add groff less python3 py3-pip pipx && \ + pipx ensurepath && pipx install awscli && \ + cp /root/.local/bin/aws* /usr/local/bin && \ + apk --purge -v del py-pip && \ + rm /var/cache/apk/* + COPY --from=docker/compose:1.29.2 /usr/local/bin/docker-compose /usr/bin/docker-compose -COPY ./buildpack.json /buildpack.json -COPY ./git-ask-pass.sh /git-ask-pass.sh -RUN chmod +x /git-ask-pass.sh +COPY ./buildpack.json /git-ask-pass.sh / -RUN (curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack) +# COPY ./git-ask-pass.sh /git-ask-pass.sh +RUN chmod +x /git-ask-pass.sh && \ + (curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack) COPY --from=build-env /go/bin/cirunner . COPY ./ssh-config /root/.ssh/config RUN chmod 644 /root/.ssh/config # passing PARENT_MODE as argument to cirunner as default behavior -ENTRYPOINT ["./cirunner", "PARENT_MODE"] \ No newline at end of file +ENTRYPOINT ["./cirunner", "PARENT_MODE"]