-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (40 loc) · 1.4 KB
/
Dockerfile
File metadata and controls
50 lines (40 loc) · 1.4 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
FROM ubuntu:24.04@sha256:9cbed754112939e914291337b5e554b07ad7c392491dba6daf25eef1332a22e8 AS base
ARG GO_VERSION=1.25.0
# Install dependencies, download Go, and set it up in one layer
RUN set -eux && \
apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates=20240203 \
wget=1.21.4-1ubuntu4.1 && \
wget -O go.tar.gz "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" && \
tar -C /usr/local -xzf go.tar.gz && \
rm go.tar.gz && \
rm /root/.wget-hsts && \
mkdir -p /go/src /go/bin && \
chmod -R 750 /go && \
apt-get clean && apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/log/apt/* && \
rm -rf /var/log/dpkg.log
# Set environment variables
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
ENV CGO_ENABLED=0
# Set the working directory
WORKDIR /go
FROM ubuntu:24.04@sha256:9cbed754112939e914291337b5e554b07ad7c392491dba6daf25eef1332a22e8
RUN set -eux && \
apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates=20240203 && \
apt-get clean && apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/log/apt/* && \
rm -rf /var/log/dpkg.log
# Set environment variables
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
ENV CGO_ENABLED=0
COPY --from=base /usr/local/go /usr/local/go
# Set the working directory
WORKDIR /go