FIX: 'RANDOM' not available in golang image, using 'shuf' instead.

This commit is contained in:
mason 2019-11-11 16:25:34 -08:00
parent b3734e9ff9
commit 607878c71a

View file

@ -5,7 +5,8 @@ COPY . .
RUN mkdir ./bin && \ RUN mkdir ./bin && \
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -tags netgo -installsuffix netgo -o ./bin/goStatic && \ CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -tags netgo -installsuffix netgo -o ./bin/goStatic && \
mkdir ./bin/etc && \ mkdir ./bin/etc && \
UI=$(( ( RANDOM % 9999 ) + 99 )) && \ ID=$(shuf -i 100-9999 -n 1) && \
echo $ID && \
echo "appuser:x:$ID:$ID::/sbin/nologin:/bin/false" > ./bin/etc/passwd && \ echo "appuser:x:$ID:$ID::/sbin/nologin:/bin/false" > ./bin/etc/passwd && \
echo "appgroup:x:$ID:appuser" > ./bin/etc/group echo "appgroup:x:$ID:appuser" > ./bin/etc/group
@ -15,3 +16,4 @@ WORKDIR /
COPY --from=builder /go/src/github.com/PierreZ/goStatic/bin/ . COPY --from=builder /go/src/github.com/PierreZ/goStatic/bin/ .
USER appuser USER appuser
ENTRYPOINT ["/goStatic"] ENTRYPOINT ["/goStatic"]