Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.18 AS build
COPY / /src
WORKDIR /src
RUN --mount=type=cache,target=/go/pkg --mount=type=cache,target=/root/.cache/go-build make build-local-linux

FROM ubuntu:22.04 AS base
ENV LANG=en_US.utf8

FROM base AS goreleaser
COPY kcl-openapi /usr/local/bin/kcl-openapi
RUN /usr/local/bin/kcl-openapi

FROM base
COPY --from=build /src/_build/linux/kcl-openapi /usr/local/bin/kcl-openapi
RUN /usr/local/bin/kcl-openapi
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ check-fmt:

regenerate:
go run scripts/regenerate.go

build-local-linux:
# Delete old artifacts
-rm -rf ./_build
mkdir -p ./_build/linux/

# Build kcl-openapi
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -o ./_build/linux/kcl-openapi \
-ldflags="-s -w" .