diff --git a/Dockerfile b/Dockerfile index 0cdc8e13b..2443bff8e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM golang:1.17.8 +RUN useradd -r -m cxuser +USER cxuser COPY cx /app/bin/cx ENTRYPOINT ["/app/bin/cx"] diff --git a/goreleaser/Dockerfile b/goreleaser/Dockerfile deleted file mode 100644 index 173a10469..000000000 --- a/goreleaser/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM golang:1.16.6-alpine3.14 as build-env - -ARG GIT_TOKEN - -ENV GOPRIVATE="" - -# Copy the source from the current directory to the Working Directory inside the container -WORKDIR /app - -RUN apk add --no-cache git \ - && git config \ - --global \ - url."https://api:${GIT_TOKEN}@github.com".insteadOf \ - "https://github.com" - -#Copy go mod and sum files -COPY ../go.mod . -COPY ../go.sum . - -# Get dependancies - will also be cached if we won't change mod/sum -RUN go mod download - -# COPY the source code as the last step -COPY .. . - -# RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o bin/cx cmd/main.go -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOPRIVATE="" go build -a -installsuffix cgo -o bin/cx cmd/main.go - -#runtime image -FROM golang:1.16.6-alpine3.14 - -COPY --from=build-env /app/bin/cx /app/bin/cx - -ENTRYPOINT ["/app/bin/cx"]