Skip to content

Commit

Permalink
feat:added kcl-builder-alpine
Browse files Browse the repository at this point in the history
Signed-off-by: shruti2522 <[email protected]>
  • Loading branch information
shruti2522 committed Apr 23, 2024
1 parent 7e8007a commit 3d6122b
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
50 changes: 50 additions & 0 deletions scripts/docker/kcl-builder-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2021 The KCL Authors. All rights reserved.

FROM alpine:latest

# set timezone
RUN apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo 'Asia/Shanghai' >/etc/timezone

# update repositories and install required packages
RUN apk add --no-cache \
make \
wget \
git \
ca-certificates \
clang \
llvm \
libffi-dev \
go \
python3 \
python3-dev \
py3-pip

# set environment variables
ENV GOPATH=/go \
GOLANG_VERSION=1.20.5 \
PATH="/root/.cargo/bin:${PATH}" \
CARGO_NET_GIT_FETCH_WITH_CLI=true

# install rust and cargo
RUN wget -qO- https://sh.rustup.rs | sh -s -- -y \
&& echo 'source $HOME/.cargo/env' >> $HOME/.ashrc \
&& . $HOME/.cargo/env \
&& cargo version \
&& rustc --version

# install go tools
RUN go install golang.org/x/lint/golint@latest \
&& go install golang.org/x/tools/cmd/goimports@latest \
&& go install github.com/t-yuki/gocover-cobertura@latest \
&& go install github.com/jstemmer/go-junit-report@latest

RUN rm -rf /root/.cache/go-build \
&& rm -rf /go/pkg/mod \
&& rm -rf /go/pkg/sumdb \
&& rm -rf /var/cache/apk/*

WORKDIR /root

CMD ["ash"]
30 changes: 30 additions & 0 deletions scripts/docker/kcl-builder-alpine/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2021 The KCL Authors. All rights reserved.

PWD:=$(shell pwd)

BUILDER_IMAGE:=kcllang/kcl-builder-alpine

# export DOCKER_DEFAULT_PLATFORM=linux/amd64
# or
# --platform linux/amd64

RUN_IN_DOCKER:=docker run -it --rm --platform linux/amd64
RUN_IN_DOCKER+=-v ~/.ssh:/root/.ssh
RUN_IN_DOCKER+=-v ~/.gitconfig:/root/.gitconfig
RUN_IN_DOCKER+=-v ~/go/pkg/mod:/go/pkg/mod

kcl-builder:
docker build --platform linux/amd64 -t ${BUILDER_IMAGE} .
@echo "ok"

publish-builder:
# docker login --username=

# make kcl-builder
docker push ${BUILDER_IMAGE}
@echo "push ${BUILDER_IMAGE} ok"

sh-in-builder:
${RUN_IN_DOCKER} -v ${PWD}/../../..:/root/kclvm -w /root ${BUILDER_IMAGE} sh

clean:

0 comments on commit 3d6122b

Please sign in to comment.