add docker

Signed-off-by: Pakin <pakin.t@forth.co.th>
This commit is contained in:
Pakin 2025-12-11 10:56:58 +07:00
parent 170c3c1511
commit c63ea98480
2 changed files with 28 additions and 0 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
.env
.git

26
Dockerfile Normal file
View file

@ -0,0 +1,26 @@
FROM golang:1.24-alpine as golang
RUN apk add -U tzdata
RUN apk --update add ca-certificates
WORKDIR /app
COPY . .
RUN go mod download
RUN go mod verify
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server .
FROM scratch
COPY --from=golang /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=golang /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=golang /etc/passwd /etc/passwd
COPY --from=golang /etc/group /etc/group
COPY --from=golang /server .
EXPOSE 8080
EXPOSE 50051
CMD ["/server"]