goscan/Dockerfile
Shane C 85b8899056
All checks were successful
Gosec Check / Gosec Check (push) Successful in 24s
download gosec at build
2024-09-08 14:57:55 -04:00

24 lines
No EOL
757 B
Docker

FROM golang:1.22-alpine3.20 AS builder
WORKDIR /app
COPY . .
RUN go mod download && go mod verify
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -o build/goscan
FROM alpine:3.20
RUN apk --no-cache update && apk --no-cache upgrade && apk add wget curl
RUN wget https://go.dev/dl/go1.23.1.linux-amd64.tar.gz && tar -xf go1.23.1.linux-amd64.tar.gz -C /usr/local && rm -rf go1.23.1.linux-amd64.tar.gz
COPY --from=builder /app/build/goscan /goscan
COPY ./entrypoint.sh /entrypoint.sh
COPY --from=builder /app .
RUN chmod +x /goscan && chmod +x /entrypoint.sh
RUN curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b /usr/local/bin
USER nobody
ENV PATH="/usr/local/go/bin:${PATH}"
ENTRYPOINT ["/entrypoint.sh"]