Skip to content

Commit

Permalink
add runtime cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
motoki317 committed May 4, 2023
1 parent d09d37a commit 43afa2a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,35 @@ ENV GOARCH=$TARGETARCH
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
go build -o /dev-ops-bot -ldflags="-s -w -X main.version=$VERSION" .

FROM --platform=$BUILDPLATFORM golang:1.20-alpine AS installer

ENV CGO_ENABLED 0
ARG TARGETOS
ARG TARGETARCH
ENV GOOS=$TARGETOS
ENV GOARCH=$TARGETARCH

RUN apk add --no-cache wget

RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_"$TARGETOS"_"$TARGETARCH" -O /yq && \
chmod +x /yq

RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
go install sigs.k8s.io/kustomize/kustomize/v5@latest
# keep output directory the same between platforms; workaround for https://github.com/golang/go/issues/57485
RUN cp /go/bin/kustomize /kustomize || cp /go/bin/"$GOOS"_"$GOARCH"/kustomize /kustomize

FROM alpine:3

WORKDIR /work

# Install commands for deploy scripts
RUN apk add --no-cache git openssh
RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts

COPY --from=installer /yq /usr/local/bin/
COPY --from=installer /kustomize /usr/local/bin/

COPY --from=builder /dev-ops-bot ./

ENTRYPOINT ["/work/dev-ops-bot"]
2 changes: 2 additions & 0 deletions deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func (dc *DeployCommand) Execute(ctx *Context) error {
}

// Run
_ = ctx.ReplyRunning()

var args []string
args = append(args, c.argsPrefix...)
args = append(args, ctx.Args[2:]...)
Expand Down

0 comments on commit 43afa2a

Please sign in to comment.