@@ -16,23 +16,28 @@ RUN echo '#!/bin/bash' > /entrypoint.sh \
16
16
&& echo 'cd /workspace/src/' >> /entrypoint.sh \
17
17
&& echo '/usr/local/go/bin/go clean' >> /entrypoint.sh \
18
18
&& echo 'echo "[+] Building"' >> /entrypoint.sh \
19
- # && echo 'echo " ├──[>] Building for linux i386"' >> /entrypoint.sh \
20
- # && echo 'mkdir -p /workspace/bin/linux/x86/' >> /entrypoint.sh >> /entrypoint.sh \
21
- # && echo 'GOOS=linux GOARCH=386 /usr/local/go/bin/go build -o /workspace/bin/linux/x86/ -buildvcs=false' >> /entrypoint.sh \
22
- && echo 'echo " ├──[>] Building for linux amd64"' >> /entrypoint.sh \
23
- && echo 'mkdir -p /workspace/bin/linux/x64/' >> /entrypoint.sh >> /entrypoint.sh \
24
- && echo 'GOOS=linux GOARCH=amd64 /usr/local/go/bin/go build -o /workspace/bin/linux/x64/ -buildvcs=false' >> /entrypoint.sh \
25
- # && echo 'echo " ├──[>] Building for Windows i386"' >> /entrypoint.sh \
26
- # && echo 'mkdir -p /workspace/bin/windows/x86/' >> /entrypoint.sh >> /entrypoint.sh \
27
- # && echo 'GOOS=windows GOARCH=386 /usr/local/go/bin/go build -o /workspace/bin/windows/x86/ -buildvcs=false' >> /entrypoint.sh \
28
- # && echo 'echo " └──[>] Building for Windows amd64"' >> /entrypoint.sh \
29
- # && echo 'mkdir -p /workspace/bin/windows/x64/' >> /entrypoint.sh >> /entrypoint.sh \
30
- # && echo 'GOOS=windows GOARCH=amd64 /usr/local/go/bin/go build -o /workspace/bin/windows/x64/ -buildvcs=false' >> /entrypoint.sh \
19
+ && echo 'if [ $# -ge 2 ]; then' >> /entrypoint.sh \
20
+ && echo ' OS=$1' >> /entrypoint.sh \
21
+ && echo ' GOARCH=$2' >> /entrypoint.sh \
22
+ && echo 'else' >> /entrypoint.sh \
23
+ && echo ' OS=$(uname -s | tr "[:upper:]" "[:lower:]")' >> /entrypoint.sh \
24
+ && echo ' ARCH=$(uname -m)' >> /entrypoint.sh \
25
+ && echo ' case $ARCH in' >> /entrypoint.sh \
26
+ && echo ' x86_64) GOARCH="amd64" ;;' >> /entrypoint.sh \
27
+ && echo ' i386|i686) GOARCH="386" ;;' >> /entrypoint.sh \
28
+ && echo ' aarch64) GOARCH="arm64" ;;' >> /entrypoint.sh \
29
+ && echo ' armv7*) GOARCH="arm" ;;' >> /entrypoint.sh \
30
+ && echo ' *) echo "Unsupported architecture $ARCH"; exit 1 ;;' >> /entrypoint.sh \
31
+ && echo ' esac' >> /entrypoint.sh \
32
+ && echo 'fi' >> /entrypoint.sh \
33
+ && echo 'echo " ├──[>] Building for $OS $GOARCH"' >> /entrypoint.sh \
34
+ && echo 'mkdir -p "/workspace/bin/$OS/$GOARCH/"' >> /entrypoint.sh \
35
+ && echo 'GOOS=$OS GOARCH=$GOARCH /usr/local/go/bin/go build -o "/workspace/bin/$OS/$GOARCH/" -buildvcs=false' >> /entrypoint.sh \
31
36
&& chmod +x /entrypoint.sh
32
37
33
38
# Prepare workspace volume
34
39
RUN mkdir -p /workspace/
35
40
VOLUME /workspace/
36
41
WORKDIR /workspace/
37
42
38
- CMD [ "/bin/bash" , "/entrypoint.sh" ]
43
+ ENTRYPOINT [ "/entrypoint.sh" ]
0 commit comments