Dockerfile 442 B

123456789101112131415161718192021
  1. FROM golang:1.21-alpine AS builder
  2. WORKDIR /app
  3. COPY go.mod go.sum ./
  4. RUN go mod download
  5. COPY . .
  6. RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o main ./cmd
  7. FROM alpine:latest
  8. RUN apk --no-cache add ca-certificates
  9. WORKDIR /root/
  10. COPY --from=builder /app/main .
  11. COPY --from=builder /app/web ./web
  12. COPY --from=builder /app/configs ./configs
  13. EXPOSE 53/udp 67/udp 8080/tcp
  14. CMD ["./main", "-config", "configs/config.json"]