Skip to content

Commit e22d1c4

Browse files
authored
fix: add dockerfile for docker release (#38)
fix: add release dockerfile
1 parent c7da51e commit e22d1c4

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM golang:1.18 AS build
2+
COPY / /src
3+
WORKDIR /src
4+
RUN --mount=type=cache,target=/go/pkg --mount=type=cache,target=/root/.cache/go-build make build-local-linux
5+
6+
FROM ubuntu:22.04 AS base
7+
ENV LANG=en_US.utf8
8+
9+
FROM base AS goreleaser
10+
COPY kcl-openapi /usr/local/bin/kcl-openapi
11+
RUN /usr/local/bin/kcl-openapi
12+
13+
FROM base
14+
COPY --from=build /src/_build/linux/kcl-openapi /usr/local/bin/kcl-openapi
15+
RUN /usr/local/bin/kcl-openapi

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ check-fmt:
1414

1515
regenerate:
1616
go run scripts/regenerate.go
17+
18+
build-local-linux:
19+
# Delete old artifacts
20+
-rm -rf ./_build
21+
mkdir -p ./_build/linux/
22+
23+
# Build kcl-openapi
24+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
25+
go build -o ./_build/linux/kcl-openapi \
26+
-ldflags="-s -w" .

0 commit comments

Comments
 (0)