Skip to content

Commit 5871078

Browse files
authored
[Enhancement] Release for Alpine linux (#1242)
feat:added kcl-builder-alpine Signed-off-by: shruti2522 <[email protected]>
1 parent 7e8007a commit 5871078

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2021 The KCL Authors. All rights reserved.
2+
3+
FROM alpine:latest
4+
5+
# set timezone
6+
RUN apk add --no-cache tzdata \
7+
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
8+
&& echo 'Asia/Shanghai' >/etc/timezone
9+
10+
# update repositories and install required packages
11+
RUN apk add --no-cache \
12+
make \
13+
wget \
14+
git \
15+
ca-certificates \
16+
clang \
17+
llvm \
18+
libffi-dev \
19+
go \
20+
python3 \
21+
python3-dev \
22+
py3-pip
23+
24+
# set environment variables
25+
ENV GOPATH=/go \
26+
GOLANG_VERSION=1.20.5 \
27+
PATH="/root/.cargo/bin:${PATH}" \
28+
CARGO_NET_GIT_FETCH_WITH_CLI=true
29+
30+
# install rust and cargo
31+
RUN wget -qO- https://sh.rustup.rs | sh -s -- -y \
32+
&& echo 'source $HOME/.cargo/env' >> $HOME/.ashrc \
33+
&& . $HOME/.cargo/env \
34+
&& cargo version \
35+
&& rustc --version
36+
37+
# install go tools
38+
RUN go install golang.org/x/lint/golint@latest \
39+
&& go install golang.org/x/tools/cmd/goimports@latest \
40+
&& go install github.com/t-yuki/gocover-cobertura@latest \
41+
&& go install github.com/jstemmer/go-junit-report@latest
42+
43+
RUN rm -rf /root/.cache/go-build \
44+
&& rm -rf /go/pkg/mod \
45+
&& rm -rf /go/pkg/sumdb \
46+
&& rm -rf /var/cache/apk/*
47+
48+
WORKDIR /root
49+
50+
CMD ["ash"]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2021 The KCL Authors. All rights reserved.
2+
3+
PWD:=$(shell pwd)
4+
5+
BUILDER_IMAGE:=kcllang/kcl-builder-alpine
6+
7+
# export DOCKER_DEFAULT_PLATFORM=linux/amd64
8+
# or
9+
# --platform linux/amd64
10+
11+
RUN_IN_DOCKER:=docker run -it --rm --platform linux/amd64
12+
RUN_IN_DOCKER+=-v ~/.ssh:/root/.ssh
13+
RUN_IN_DOCKER+=-v ~/.gitconfig:/root/.gitconfig
14+
RUN_IN_DOCKER+=-v ~/go/pkg/mod:/go/pkg/mod
15+
16+
kcl-builder:
17+
docker build --platform linux/amd64 -t ${BUILDER_IMAGE} .
18+
@echo "ok"
19+
20+
publish-builder:
21+
# docker login --username=
22+
23+
# make kcl-builder
24+
docker push ${BUILDER_IMAGE}
25+
@echo "push ${BUILDER_IMAGE} ok"
26+
27+
sh-in-builder:
28+
${RUN_IN_DOCKER} -v ${PWD}/../../..:/root/kclvm -w /root ${BUILDER_IMAGE} sh
29+
30+
clean:

0 commit comments

Comments
 (0)