-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.1.5
More file actions
57 lines (47 loc) · 1.49 KB
/
Copy pathDockerfile.1.5
File metadata and controls
57 lines (47 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# First stage: Build the builder program with modern Go
FROM golang:bullseye as builder
COPY builder/ /builder
WORKDIR /builder
RUN go build -o /builder/cloak
# Final stage: Setup environment with Go 1.18 only
FROM debian:bullseye
# Basic system utilities
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
gpg \
make \
python3 \
sed \
tar \
zip \
unzip \
mingw-w64 \
binutils-mingw-w64 \
g++-mingw-w64 \
&& rm -rf /var/lib/apt/lists/*
# Install Go 1.18 as the only Go version
RUN curl -L https://go.dev/dl/go1.18.10.linux-amd64.tar.gz | tar -C /usr/local -xzf -
# Add Go to PATH
ENV PATH="/usr/local/go/bin:/go/bin:${PATH}"
ENV GOPATH="/go"
# Set up protoc
RUN mkdir -p /usr/local/bin && \
PROTOC_VERSION="25.2" && \
PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-x86_64.zip" && \
curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" && \
unzip -o ${PROTOC_ZIP} -d /usr/local bin/protoc && \
rm -f ${PROTOC_ZIP}
# Install Go tools with Go 1.18
RUN mkdir -p /go/bin && \
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0 && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
# Copy the builder from builder stage and make it executable
COPY --from=builder /builder/cloak /usr/local/bin/
RUN chmod +x /usr/local/bin/cloak
ENV TARGET_VERSION="1.5"
# Create work directory
RUN mkdir -p /tmp/output
WORKDIR /tmp/output
CMD ["bash"]