1
0
This repository has been archived on 2024-02-27. You can view files and clone it, but cannot push or open issues or pull requests.
chatgpt-to-api/Dockerfile

37 lines
837 B
Docker
Raw Normal View History

2023-04-12 02:43:54 +00:00
# Use the official Golang image as the builder
FROM golang:1.20.3-alpine as builder
2023-04-12 02:43:54 +00:00
# Enable CGO to use C libraries (set to 0 to disable it)
# We set it to 0 to build a fully static binary for our final image
ENV CGO_ENABLED=0
2023-04-12 02:43:54 +00:00
# Set the working directory
WORKDIR /app
2023-04-12 02:43:54 +00:00
# Copy the Go Modules manifests (go.mod and go.sum files)
COPY go.mod go.sum ./
2023-04-12 02:43:54 +00:00
# Download the dependencies
RUN go mod download
2023-04-12 02:43:54 +00:00
# Copy the source code
COPY . .
# Build the Go application and install it
RUN go install .
# Use a scratch image as the final distroless image
FROM scratch
# Set the working directory
WORKDIR /app
# Copy the built Go binary from the builder stage
COPY --from=builder /go/bin/ChatGPT-Proxy-V4 /app/ChatGPT-Proxy-V4
2023-04-12 02:43:54 +00:00
# Expose the port where the application is running
EXPOSE 8080
2023-04-12 02:43:54 +00:00
# Start the application
CMD [ "./ChatGPT-Proxy-V4" ]