dockerfile
This commit is contained in:
parent
49bb36eab3
commit
8497059d11
1 changed files with 25 additions and 0 deletions
25
dockerfile
Normal file
25
dockerfile
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# use a minimal base image
|
||||||
|
FROM golang:1.21 AS builder
|
||||||
|
|
||||||
|
# set the working directory in the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# copy the go project files
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# build the go server
|
||||||
|
RUN go mod tidy && go build -o server
|
||||||
|
|
||||||
|
# create a smaller final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
WORKDIR /root/
|
||||||
|
|
||||||
|
# copy the built binary from the builder stage
|
||||||
|
COPY --from=builder /app/server .
|
||||||
|
|
||||||
|
# expose the port (match your go server's listening port)
|
||||||
|
EXPOSE 61594
|
||||||
|
|
||||||
|
# run the go server
|
||||||
|
CMD ["./server"]
|
||||||
Loading…
Reference in a new issue