1
1
ARG BASE_IMAGE
2
2
FROM ${BASE_IMAGE}
3
3
4
+ # Define Go version as build argument with default
5
+ ARG GO_VERSION=1.23.0
6
+ ARG TARGETARCH=amd64
7
+
4
8
#######################################
5
- # useradd, groupmod
6
- RUN yum install -y shadow-utils
9
+ # Install required utilities
10
+ RUN yum install -y shadow-utils wget ca-certificates tar zip
11
+
12
+ # Install gosu for running commands as another user
7
13
ENV GOSU_VERSION 1.14
8
14
# https://github.com/tianon/gosu/releases/tag/1.14
9
15
# key https://keys.openpgp.org/search?q=tianon%40debian.org
10
16
RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
11
17
&& chmod +x /usr/local/bin/gosu
12
18
19
+ # Download and install Go
20
+ RUN wget -q "https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz" -O go.tar.gz && \
21
+ echo "Downloading Go ${GO_VERSION} for ${TARGETARCH}" && \
22
+ # Remove any previous Go installation
23
+ rm -rf /usr/local/go && \
24
+ tar -C /usr/local -xzf go.tar.gz && \
25
+ rm go.tar.gz
26
+
27
+ # Add Go to PATH permanently
28
+ ENV PATH="/usr/local/go/bin:${PATH}"
13
29
30
+ # Verify installation
31
+ RUN go version
32
+
33
+ # Set up SeBS environment
14
34
RUN mkdir -p /sebs/
15
35
COPY dockerfiles/golang_installer.sh /sebs/installer.sh
16
36
COPY dockerfiles/entrypoint.sh /sebs/entrypoint.sh
17
- RUN chmod +x /sebs/entrypoint.sh
37
+ RUN chmod +x /sebs/installer.sh /sebs/ entrypoint.sh
18
38
19
39
# useradd and groupmod is installed in /usr/sbin which is not in PATH
20
- ENV PATH=/usr/sbin:$PATH
40
+ ENV PATH=/usr/sbin:${ PATH}
21
41
ENV SCRIPT_FILE=/mnt/function/package.sh
22
- CMD /bin/bash /sebs/installer.sh
23
- ENTRYPOINT ["/sebs/entrypoint.sh"]
42
+
43
+ # Set the entry point and command
44
+ ENTRYPOINT ["/sebs/entrypoint.sh"]
45
+ CMD ["/bin/bash", "/sebs/installer.sh"]
0 commit comments