-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
34 lines (23 loc) · 806 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Use the official Golang image as the base image
FROM golang:1.22-alpine AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy the go.mod and go.sum files to the working directory
COPY go.mod go.sum ./
# Download the dependencies
RUN go mod download
# Copy the source code to the working directory
COPY . .
# Build the application
RUN go build -o server
# Use a minimal Alpine image as the base image for the final image
FROM alpine:latest
# Set the working directory inside the container
WORKDIR /app
# Copy the built binary from the builder image
COPY --from=builder /app/server .
# Expose the port that the server listens on
EXPOSE 8888
# Run the server
# Open http://huma-demo.traefik.me if you are using traefik reverse proxy with docker-compose
CMD ["./server"]