Skip to content

Commit

Permalink
fix: dockerfiles
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Sep 4, 2024
1 parent ed78820 commit da9e670
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docker/amd64/Dockerfile.init
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ WORKDIR /

COPY . .

RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o webhook-init cmd/wehbook-init
# We run go mod download in a separate step so that we can cache its results.
# This lets us avoid re-downloading modules if we don't need to. The type=target
# mount tells Docker to mount the current directory read-only in the WORKDIR.
# The type=cache mount tells Docker to cache the Go modules cache across builds.
RUN --mount=target=. --mount=type=cache,target=/go/pkg/mod go mod download

RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o webhook-init cmd/wehbook-init/main.go

FROM kcllang/kcl

Expand Down
10 changes: 9 additions & 1 deletion docker/amd64/Dockerfile.server
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ WORKDIR /

COPY . .

RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o webhook-server cmd/wehbook-server
ENV CGO_ENABLED=0

# We run go mod download in a separate step so that we can cache its results.
# This lets us avoid re-downloading modules if we don't need to. The type=target
# mount tells Docker to mount the current directory read-only in the WORKDIR.
# The type=cache mount tells Docker to cache the Go modules cache across builds.
RUN --mount=target=. --mount=type=cache,target=/go/pkg/mod go mod download

RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o webhook-server cmd/wehbook-server/main.go

FROM kcllang/kcl

Expand Down

0 comments on commit da9e670

Please sign in to comment.