17 lines
291 B
Docker
17 lines
291 B
Docker
FROM golang:1.21-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
COPY . .
|
|
|
|
# Initialize and download dependencies
|
|
RUN go mod tidy
|
|
|
|
# Build the Go app
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o backend main.go
|
|
|
|
FROM alpine:latest
|
|
WORKDIR /root/
|
|
COPY --from=builder /app/backend .
|
|
EXPOSE 8080
|
|
CMD ["./backend"]
|