Commit fee2bea5 authored by duanjinfei's avatar duanjinfei

update Dockergile

parent f5a686c8
# Use the official Go image as the base image # Use the official Go image as the base image
FROM golang:1.19-alpine FROM golang:1.19-alpine AS build
# 安装 gcc RUN apk update && \
RUN apk --no-cache add gcc musl-dev apk upgrade && \
apk add --no-cache bash git openssh make build-base
# Set the working directory inside the container RUN go env -w CGO_ENABLED="1"
WORKDIR /app
# Copy the Go modules files ADD . /app
COPY go.mod go.sum ./
# Copy the source code to the container # Build the Go application
COPY . . RUN cd /app && go build -o main .
# Download the Go modules FROM alpine
RUN go get
# Build the Go application WORKDIR /app
RUN go build -o main .
COPY --from=build /app/main /app/main
COPY . .
# Expose the port that the application listens on
EXPOSE 8888 EXPOSE 8888
# Run the Go application
CMD ["./main"] CMD ["./main"]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment