Skip to content

Commit 7c2db49

Browse files
committed
feat: add all kcl dockerfiles
Signed-off-by: zongz <[email protected]>
1 parent c0dfbef commit 7c2db49

File tree

11 files changed

+514
-0
lines changed

11 files changed

+514
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 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 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:
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright The KCL Authors. All rights reserved.
2+
# Builder for kcllang/kcl-builder-arm64 image
3+
4+
FROM arm64v8/ubuntu:20.04
5+
6+
#RUN uname -a
7+
#RUN cat /etc/os-release
8+
9+
RUN apt-get update
10+
11+
RUN apt-get install -y curl make gcc git zlib1g-dev
12+
RUN apt install -y pkg-config libssl-dev
13+
14+
# rust
15+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
16+
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
17+
18+
RUN cargo version
19+
RUN rustc --version
20+
21+
# clang12
22+
RUN apt-get install -y clang-12 lld-12
23+
RUN ln -sf /usr/bin/clang-12 /usr/bin/clang
24+
RUN ln -sf /usr/bin/wasm-ld-12 /usr/bin/wasm-ld
25+
26+
WORKDIR /root
27+
28+
CMD ["bash"]
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Copyright The KCL Authors. All rights reserved.
2+
3+
FROM centos:centos7
4+
5+
# macOS M1 --platform linux/amd64
6+
# try fix "Problem with the SSL CA cert (path? access rights?)"
7+
# https://issueexplorer.com/issue/docker/for-mac/5912
8+
# https://access.redhat.com/articles/2050743
9+
RUN touch /etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned
10+
11+
# ---------------------------------------------------------------------------------
12+
# Please note: The following steps are to install the dependency packages
13+
# needed to compile CPython for centos7, see the
14+
# [Python official website](https://devguide.python.org/setup/#install-dependencies)
15+
# for details. When the version of CPython used becomes higher,
16+
# please pay attention to update the installation dependencies.
17+
# ---------------------------------------------------------------------------------
18+
19+
# Some language environments and plug-ins related to development and compilation,
20+
# such as git, CPython compilation, etc.
21+
RUN yum groupinstall -y "Development Tools"
22+
# Compiler and tool chain required to compile CPython such as gcc, make, sqlite3, ctype, struct, etc.
23+
RUN yum install -y gcc patch libffi-devel python-devel zlib-devel bzip2-devel ncurses-devel sqlite-devel
24+
RUN yum install -y libpcap-devel xz-devel readline-devel tk-devel gdbm-devel db4-deve
25+
# Install the system libraries required by python3 for UNIX based systems
26+
RUN yum -y install yum-utils
27+
RUN yum-builddep -y python3
28+
# The python zlib module dependency package is required when compiling the python source code,
29+
# in order to use the modules that require zlib, such as setuptools, etc.
30+
RUN yum install -y zlib*
31+
# The python ssl module dependency package is required when compiling the python source code,
32+
# in order to use the modules that require ssl, such as pip3, twine, etc.
33+
RUN yum install -y openssl-devel
34+
35+
# Install which
36+
RUN yum install -y which
37+
38+
# Install wget
39+
RUN yum install -y wget
40+
41+
# Install git-2.x
42+
# RUN yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
43+
# RUN yum -y install git
44+
45+
# rust
46+
# https://www.rust-lang.org/tools/install
47+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
48+
ENV PATH="/root/.cargo/bin:${PATH}"
49+
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
50+
51+
RUN cargo version
52+
RUN rustc --version
53+
54+
# wasm
55+
RUN rustup target add wasm32-unknown-unknown
56+
57+
# Install clang7 and llvm7
58+
# https://www.softwarecollections.org/en/scls/rhscl/llvm-toolset-7.0/
59+
#
60+
# 1. Install a package with repository for your system:
61+
# On CentOS, install package centos-release-scl available in CentOS repository:
62+
# $ sudo yum install centos-release-scl
63+
#
64+
# On RHEL, enable RHSCL repository for you system:
65+
# $ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
66+
#
67+
# 2. Install the collection:
68+
# $ sudo yum install llvm-toolset-7.0
69+
#
70+
# 3. Start using software collections:
71+
# $ scl enable llvm-toolset-7.0 bash
72+
73+
RUN yum -y install centos-release-scl
74+
RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
75+
RUN yum -y install llvm-toolset-7.0
76+
RUN yum -y install llvm-toolset-7.0\*
77+
RUN scl enable llvm-toolset-7.0 bash
78+
79+
# Install gcc7
80+
RUN yum -y install devtoolset-7*
81+
RUN scl enable devtoolset-7 bash
82+
RUN gcc -v
83+
84+
# rpm -ql llvm-toolset-7.0-clang.x86_64
85+
# /opt/rh/llvm-toolset-7.0/root/usr/lib64/libLLVM-7.so
86+
ENV LD_LIBRARY_PATH="/opt/rh/llvm-toolset-7.0/root/usr/lib64:${LD_LIBRARY_PATH}"
87+
ENV PATH="/opt/rh/llvm-toolset-7.0/root/usr/bin:${PATH}"
88+
89+
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
90+
RUN echo 'Asia/Shanghai' >/etc/timezone
91+
92+
WORKDIR /root
93+
94+
CMD ["bash"]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright The KCL Authors. All rights reserved.
2+
3+
PWD:=$(shell pwd)
4+
5+
BUILDER_IMAGE:=kcllang/kcl-builder:centos7
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+
# https://docker.inc.com/
22+
# docker login --username=
23+
24+
# make kcl-builder
25+
docker push ${BUILDER_IMAGE}
26+
@echo "push ${BUILDER_IMAGE} ok"
27+
28+
sh:
29+
${RUN_IN_DOCKER} -v ${PWD}/../../..:/root/kclvm -w /root ${BUILDER_IMAGE} bash
30+
31+
clean:
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright The KCL Authors. All rights reserved.
2+
3+
FROM centos:centos8
4+
5+
# macOS M1 --platform linux/amd64
6+
# try fix "Problem with the SSL CA cert (path? access rights?)"
7+
# https://issueexplorer.com/issue/docker/for-mac/5912
8+
# https://access.redhat.com/articles/2050743
9+
RUN touch /etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned
10+
11+
# https://forketyfork.medium.com/centos-8-no-urls-in-mirrorlist-error-3f87c3466faa
12+
RUN sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
13+
RUN sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
14+
15+
RUN yum -y install make
16+
RUN yum -y install which
17+
RUN yum -y install wget
18+
RUN yum -y install git
19+
20+
# ca-certificates
21+
RUN yum -y install ca-certificates
22+
23+
# rust-1.54.0
24+
# cargo 1.54.0
25+
# RUN yum -y install rust cargo rustfmt
26+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
27+
RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
28+
29+
ENV PATH="/root/.cargo/bin:${PATH}"
30+
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
31+
32+
RUN cargo version
33+
RUN rustc --version
34+
35+
# clang-12
36+
RUN yum -y install clang
37+
RUN clang --version
38+
39+
# llvm-12
40+
RUN yum -y install llvm-devel
41+
RUN yum -y install libffi-devel
42+
RUN ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so
43+
44+
# golang 1.19+
45+
RUN mkdir -p /root/download && cd /root/download \
46+
&& wget https://dl.google.com/go/go1.20.5.linux-amd64.tar.gz \
47+
&& tar -zxvf go1.20.5.linux-amd64.tar.gz \
48+
&& mv ./go /usr/local/go1.20.5
49+
RUN ln -sf /usr/local/go1.20.5/bin/go /usr/bin/go
50+
RUN rm -rf /root/download
51+
52+
ENV GOPATH=/go
53+
ENV GOLANG_VERSION=1.20.5
54+
55+
RUN go install golang.org/x/lint/golint@latest
56+
RUN go install golang.org/x/tools/cmd/goimports@latest
57+
# RUN go install honnef.co/go/tools/cmd/...@latest
58+
59+
RUN go install github.com/t-yuki/gocover-cobertura@latest
60+
RUN go install github.com/jstemmer/go-junit-report@latest
61+
62+
RUN rm -rf /go/pkg/mod
63+
RUN rm -rf /go/pkg/sumdb
64+
65+
# /usr/lib64/python3.9
66+
RUN yum -y install python39-devel
67+
RUN python3 -m pip install pytest
68+
69+
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
70+
RUN echo 'Asia/Shanghai' >/etc/timezone
71+
72+
RUN mkdir -p /root/.cargo && touch /root/.cargo/env
73+
74+
WORKDIR /root
75+
76+
CMD ["bash"]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright The KCL Authors. All rights reserved.
2+
3+
PWD:=$(shell pwd)
4+
5+
BUILDER_IMAGE:=kcllang/kcl-builder:centos8
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+
# https://docker.inc.com/
22+
# docker login --username=
23+
24+
# make kcl-builder
25+
docker push ${BUILDER_IMAGE}
26+
@echo "push ${BUILDER_IMAGE} ok"
27+
28+
sh-in-builder:
29+
${RUN_IN_DOCKER} -v ${PWD}/../../..:/root/kclvm -w /root ${BUILDER_IMAGE} bash
30+
31+
clean:
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright The KCL Authors. All rights reserved.
2+
3+
FROM fedora:39
4+
5+
# Fix SSL CA cert issue
6+
RUN touch /etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned
7+
8+
# Fix mirrorlist issue
9+
RUN sed -i -e "s|metalink=|#metalink=|g" /etc/yum.repos.d/fedora*.repo
10+
RUN sed -i -e "s|#baseurl=http://download.example/pub/fedora/linux|baseurl=https://dl.fedoraproject.org/pub/fedora/linux|g" /etc/yum.repos.d/fedora*.repo
11+
12+
# install necessary packages
13+
RUN dnf -y install make which wget git ca-certificates clang llvm-devel libffi-devel python3-devel
14+
15+
# rust
16+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \
17+
echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
18+
ENV PATH="/root/.cargo/bin:${PATH}"
19+
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
20+
21+
# go
22+
RUN mkdir -p /root/download && cd /root/download \
23+
&& wget https://dl.google.com/go/go1.20.5.linux-amd64.tar.gz \
24+
&& tar -zxvf go1.20.5.linux-amd64.tar.gz \
25+
&& mv ./go /usr/local/go1.20.5
26+
RUN ln -sf /usr/local/go1.20.5/bin/go /usr/bin/go
27+
RUN rm -rf /root/download
28+
ENV GOPATH=/go
29+
ENV GOLANG_VERSION=1.20.5
30+
31+
# go tools
32+
RUN go install golang.org/x/lint/golint@latest \
33+
&& go install golang.org/x/tools/cmd/goimports@latest \
34+
&& go install github.com/t-yuki/gocover-cobertura@latest \
35+
&& go install github.com/jstemmer/go-junit-report@latest
36+
37+
RUN python3 -m pip install pytest
38+
39+
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
40+
RUN echo 'Asia/Shanghai' >/etc/timezone
41+
42+
RUN mkdir -p /root/.cargo && touch /root/.cargo/env
43+
44+
WORKDIR /root
45+
46+
CMD ["bash"]

0 commit comments

Comments
 (0)