11ARG BASE_IMAGE
22FROM ${BASE_IMAGE}
33
4+ # Define Go version as build argument with default
5+ ARG GO_VERSION=1.23.0
6+ ARG TARGETARCH=amd64
7+
48#######################################
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
713ENV GOSU_VERSION 1.14
814# https://github.com/tianon/gosu/releases/tag/1.14
915# key https://keys.openpgp.org/search?q=tianon%40debian.org
1016RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
1117 && chmod +x /usr/local/bin/gosu
1218
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}"
1329
30+ # Verify installation
31+ RUN go version
32+
33+ # Set up SeBS environment
1434RUN mkdir -p /sebs/
1535COPY dockerfiles/golang_installer.sh /sebs/installer.sh
1636COPY dockerfiles/entrypoint.sh /sebs/entrypoint.sh
17- RUN chmod +x /sebs/entrypoint.sh
37+ RUN chmod +x /sebs/installer.sh /sebs/ entrypoint.sh
1838
1939# 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}
2141ENV 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