diff --git a/Dockerfile b/Dockerfile index d85c6cf..1ace648 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM golang:1.24.1 +# build +FROM golang:1.24.1 AS builder WORKDIR /app @@ -7,8 +8,15 @@ RUN go mod download COPY . . -RUN go build -o /api . +RUN CGO_ENABLED=0 GOOS=linux go build -o api . -EXPOSE 8080 +# copy +FROM alpine:latest -CMD [ "/api" ] \ No newline at end of file +WORKDIR /app + +COPY --from=builder /app/api . + +EXPOSE 8888 + +CMD [ "/app/api" ] diff --git a/go.sum b/go.sum index a92bd48..a5e42e0 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,6 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= -github.com/lmittmann/tint v1.0.5 h1:NQclAutOfYsqs2F1Lenue6OoWCajs5wJcP3DfWVpePw= -github.com/lmittmann/tint v1.0.5/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE= github.com/lmittmann/tint v1.0.6 h1:vkkuDAZXc0EFGNzYjWcV0h7eEX+uujH48f/ifSkJWgc= github.com/lmittmann/tint v1.0.6/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE= github.com/lmittmann/tint v1.0.7 h1:D/0OqWZ0YOGZ6AyC+5Y2kD8PBEzBk6rFHVSfOqCkF9Y=