From 0c510bfcb17725db9ec31c14740279edf94018e1 Mon Sep 17 00:00:00 2001 From: Jerry Ng Date: Sat, 3 Feb 2024 19:29:02 +0800 Subject: [PATCH] fix(docker): set CGO_ENABLED=1 --- docker/Dockerfile | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7e25c97..46617b1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,25 +1,32 @@ +# Build stage FROM golang:1.21-alpine AS go-builder -RUN apk update -RUN apk add --no-cache ca-certificates -RUN apk add --update gcc musl-dev -RUN update-ca-certificates + +RUN apk update && + apk add --no-cache ca-certificates gcc musl-dev && + update-ca-certificates WORKDIR $GOPATH/src/github.com/ngshiheng/michelin-my-maps +COPY go.mod go.sum ./ +RUN go mod download + COPY . . -RUN go build -o /bin/mym ./cmd/mym +RUN CGO_ENABLED=1 go build -o /bin/mym ./cmd/mym +# Final stage FROM datasetteproject/datasette + RUN datasette install datasette-publish-vercel COPY --from=go-builder /bin/mym /bin/mym ARG VERCEL_TOKEN ENV VERCEL_TOKEN=${VERCEL_TOKEN} -RUN apt-get update -yq -RUN apt-get -yq install curl gnupg ca-certificates -RUN curl -L https://deb.nodesource.com/setup_18.x | bash -RUN apt-get install -yq nodejs -RUN npm i -g vercel + +RUN apk update && + apk add --no-cache curl gnupg nodejs && + curl -fsSL https://deb.nodesource.com/setup_18.x | sh - && + npm i -g vercel COPY . . + CMD ["./docker/docker-entrypoint.sh"]