Commit fee2bea5 authored by duanjinfei's avatar duanjinfei

update Dockergile

parent f5a686c8
# Use the official Go image as the base image
FROM golang:1.19-alpine
FROM golang:1.19-alpine AS build
# 安装 gcc
RUN apk --no-cache add gcc musl-dev
RUN apk update && \
apk upgrade && \
apk add --no-cache bash git openssh make build-base
# Set the working directory inside the container
WORKDIR /app
RUN go env -w CGO_ENABLED="1"
# Copy the Go modules files
COPY go.mod go.sum ./
ADD . /app
# Copy the source code to the container
COPY . .
# Build the Go application
RUN cd /app && go build -o main .
# Download the Go modules
RUN go get
FROM alpine
# Build the Go application
RUN go build -o main .
WORKDIR /app
COPY --from=build /app/main /app/main
COPY . .
# Expose the port that the application listens on
EXPOSE 8888
# Run the Go application
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