# Use the official Go image as the base image
FROM golang:1.19-alpine

# 安装 gcc
RUN apk --no-cache add gcc musl-dev

# Set the working directory inside the container
WORKDIR /app

# Copy the Go modules files
COPY go.mod go.sum ./

# Copy the source code to the container
COPY . .

# Download the Go modules
RUN go get

# Build the Go application
RUN go build -o main .

# Expose the port that the application listens on
EXPOSE 8888

# Run the Go application
CMD ["./main"]