Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade go version to 1.19.10 in build image #934

Merged
merged 4 commits into from
Jun 15, 2023
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
16 changes: 0 additions & 16 deletions docker/Dockerfile.c7-systemd-linux

This file was deleted.

6 changes: 6 additions & 0 deletions docker/Dockerfile.centos7-cve-fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM centos:centos7.9.2009
ENV container docker

RUN yum update -y && yum upgrade -y && yum -y clean all && rm -fr /var/cache && rm -rf /core.*

CMD ["/usr/sbin/init"]
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM local/ilogtail-toolchain-linux-amd64 as dep-build
FROM --platform=$TARGETPLATFORM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-toolchain-linux:1.2.0 as dep-build

RUN curl -sSfL https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/toolchain/goc-v1.4.1-linux-amd64.tar.gz -o goc-v1.4.1-linux-amd64.tar.gz && \
tar -xzf goc-v1.4.1-linux-amd64.tar.gz
ARG TARGETPLATFORM

RUN curl -sSfL https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/prebuilt-dependencies/ilogtail-deps.linux-amd64.tar.gz -o ilogtail-deps.linux-amd64.tar.gz && \
tar -xzf ilogtail-deps.linux-amd64.tar.gz
RUN curl -sSfL https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/toolchain/goc-v1.4.1-linux-${TARGETPLATFORM##*/}.tar.gz -o goc-v1.4.1-linux-${TARGETPLATFORM##*/}.tar.gz && \
tar -xzf goc-v1.4.1-linux-${TARGETPLATFORM##*/}.tar.gz

FROM local/ilogtail-toolchain-linux-amd64
RUN curl -sSfL https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/prebuilt-dependencies/ilogtail-deps.linux-${TARGETPLATFORM##*/}.tar.gz -o ilogtail-deps.linux-${TARGETPLATFORM##*/}.tar.gz && \
tar -xzf ilogtail-deps.linux-${TARGETPLATFORM##*/}.tar.gz && \
mv ilogtail-deps.linux-${TARGETPLATFORM##*/} ilogtail-deps

FROM --platform=$TARGETPLATFORM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-toolchain-linux:1.2.0
RUN mkdir -p /usr/local/bin /opt/logtail
# install goc for coverage
COPY --from=dep-build goc /usr/local/bin
# install c++ deps
COPY --from=dep-build ilogtail-deps.linux-amd64 /opt/logtail/deps
COPY --from=dep-build ilogtail-deps /opt/logtail/deps

ARG USERNAME=admin
ARG USER_UID=500
Expand Down
31 changes: 0 additions & 31 deletions docker/Dockerfile.ilogtail-build-linux-arm64

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM local/c7-systemd-linux-arm64 as toolchain-build
FROM --platform=$TARGETPLATFORM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/centos7-cve-fix:1.0.0 as toolchain-build

ARG TARGETPLATFORM

# install dependencies
RUN yum -y install epel-release centos-release-scl
Expand All @@ -20,10 +22,12 @@ ENV MANPATH=/opt/rh/devtoolset-8/root/usr/share/man \
WORKDIR /

# prepare cmake
RUN wget -nv https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/toolchain/cmake-3.23.2-linux-aarch64.tar.gz && \
tar -xzf cmake-3.23.2-linux-aarch64.tar.gz
ENV CMAKE_ROOT=/cmake-3.23.2-linux-aarch64 \
PATH=/cmake-3.23.2-linux-aarch64/bin:$PATH
RUN [[ ${TARGETPLATFORM##*/} == 'amd64' ]] && ARCH='x86_64' || ARCH='aarch64' && \
wget -nv https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/toolchain/cmake-3.23.2-linux-${ARCH}.tar.gz && \
tar -xzf cmake-3.23.2-linux-${ARCH}.tar.gz && \
mv cmake-3.23.2-linux-${ARCH} cmake-3.23.2
ENV CMAKE_ROOT=/cmake-3.23.2 \
PATH=/cmake-3.23.2/bin:$PATH

# build clang
RUN wget -nv https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/toolchain/llvm-project-14.0.0.src.tar.xz && \
Expand All @@ -45,43 +49,45 @@ RUN wget -nv https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/too
cd /

# prepare go
RUN wget -nv https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/toolchain/go1.18.5.linux-arm64.tar.gz && \
tar -xzf go1.18.5.linux-arm64.tar.gz
RUN wget -nv https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/toolchain/go1.19.10.linux-${TARGETPLATFORM##*/}.tar.gz && \
tar -xzf go1.19.10.linux-${TARGETPLATFORM##*/}.tar.gz

# prepare golangci-lint
RUN wget -nv https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/toolchain/golangci-lint-1.49.0-linux-arm64.tar.gz && \
tar -xzf golangci-lint-1.49.0-linux-arm64.tar.gz
RUN wget -nv https://ilogtail-community-edition.oss-cn-shanghai.aliyuncs.com/toolchain/golangci-lint-1.53.2-linux-${TARGETPLATFORM##*/}.tar.gz && \
tar -xzf golangci-lint-1.53.2-linux-${TARGETPLATFORM##*/}.tar.gz && \
mv golangci-lint-1.53.2-linux-${TARGETPLATFORM##*/} golangci-lint-1.53.2

FROM local/c7-systemd-linux-arm64
FROM --platform=$TARGETPLATFORM sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/centos7-cve-fix:1.0.0

# install dev tool set and debug utilities
RUN yum -y install gcc gcc-c++ make libuuid-devel libstdc++-static systemd-devel iproute gdb net-tools which wget vim tree man openssh-clients sudo && \
yum -y clean all && rm -fr /var/cache && rm -rf /core.*
RUN debuginfo-install -y glibc-2.17-326.el7_9.aarch64 libuuid-2.23.2-65.el7_9.1.aarch64
RUN [[ ${TARGETPLATFORM##*/} == 'amd64' ]] && ARCH='x86_64' || ARCH='aarch64' && \
debuginfo-install -y glibc-2.17-326.el7_9.${ARCH} libuuid-2.23.2-65.el7_9.1.${ARCH}

# install cmake
COPY --from=toolchain-build /cmake-3.23.2-linux-aarch64 /usr/
COPY --from=toolchain-build /cmake-3.23.2 /usr/

# install clang-format
COPY --from=toolchain-build /llvm-project-14.0.0.src/build/bin/clang-format /usr/bin/
RUN chmod +x /usr/bin/clang-format

# install golang
WORKDIR /
COPY --from=toolchain-build /go /go
ENV GOROOT=/go GOPATH=/opt/go PATH=/go/bin:$PATH
COPY --from=toolchain-build /go /usr/local/go
ENV GOROOT=/usr/local/go GOPATH=/opt/go PATH=/usr/local/go/bin:$PATH

# install golangci-lint
COPY --from=toolchain-build /golangci-lint-1.49.0-linux-arm64/golangci-lint /opt/go/bin/
COPY --from=toolchain-build /golangci-lint-1.53.2/golangci-lint /opt/go/bin/

# install go language server
RUN go env -w GOPROXY="https://goproxy.cn,direct"
RUN go install golang.org/x/tools/gopls@v0.10.1 && \
go install github.com/go-delve/delve/cmd/dlv@v1.6.1 && \
go install github.com/josharian/impl@v1.1.0 && \
RUN go install golang.org/x/tools/gopls@v0.12.2 && \
go install github.com/go-delve/delve/cmd/dlv@v1.20.2 && \
go install github.com/josharian/impl@v1.2.0 && \
go install github.com/fatih/gomodifytags@v1.16.0 && \
go install github.com/cweill/gotests/gotests@v1.6.0 && \
go install honnef.co/go/tools/cmd/staticcheck@v0.2.2
go install honnef.co/go/tools/cmd/staticcheck@v0.4.3

# install git
COPY --from=toolchain-build /git-2.29.3/git /usr/bin
Expand Down
89 changes: 0 additions & 89 deletions docker/Dockerfile.ilogtail-toolchain-linux-amd64

This file was deleted.

10 changes: 0 additions & 10 deletions docker/Dockerfile_production
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ FROM centos:centos7.9.2009
MAINTAINER TomYu yyuuttaaoo@gmail.com

ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]

RUN yum update -y && yum upgrade -y && yum -y clean all && rm -fr /var/cache && rm -rf /core.*

Expand Down
6 changes: 3 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Dockerfiles to build build image

Dockerfile.c7-systemd-linux: base system
Dockerfile.ilogtail-toolchain-linux-amd64: install toolchain
Dockerfile.ilogtail-build-linux-amd64: add dependencies
Dockerfile.centos7-cve-fix: base system
Dockerfile.ilogtail-toolchain-linux: install toolchain
Dockerfile.ilogtail-build-linux: add dependencies

## Dockerfiles to build iLogtail

Expand Down
29 changes: 0 additions & 29 deletions docker/build-mono-arch-build-image.sh

This file was deleted.

39 changes: 15 additions & 24 deletions docker/build-multi-arch-build-image.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
#!/usr/bin/env bash
#docker buildx build --platform linux/amd64,linux/arm64 \
# -t sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/centos7-cve-fix:1.0.0 \
# -o type=registry \
# --no-cache -f Dockerfile.centos7-cve-fix .

# Copyright 2022 iLogtail Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#docker buildx build --platform linux/amd64,linux/arm64 \
# -t sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-toolchain-linux:1.2.0 \
# -o type=registry \
# --no-cache -f Dockerfile.ilogtail-toolchain-linux .

set -ue
set -o pipefail
#docker buildx build --platform linux/amd64,linux/arm64 \
# -t sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:1.2.0 \
# -o type=registry \
# --no-cache -f Dockerfile.ilogtail-build-linux .

TAG_VERSION=latest
#curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 >regctl

docker manifest rm sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:${TAG_VERSION}
docker manifest create \
sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:${TAG_VERSION} \
--amend sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux-amd64:${TAG_VERSION} \
--amend sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux-arm64:${TAG_VERSION}

docker manifest push sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:${TAG_VERSION}
regctl image copy sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:1.2.0 \
sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:latest