diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 5641f1e..6d4c865 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -22,12 +22,12 @@ jobs: with: fetch-depth: 0 - run: echo "🛠️ The Gitea Actions workflow is now ready to test your code on the runner." - - name: Install Go - run: | - apt-get update - apt-get install -y golang - - name: Set Go Proxy - run: go env -w GOPROXY=https://goproxy.cn,direct + # - name: Install Go + # run: | + # apt-get update + # apt-get install -y golang + # - name: Set Go Proxy + # run: go env -w GOPROXY=https://goproxy.cn,direct - name: Build Docker image run: docker build -t my-docker-image . - name: Deploy to local Docker diff --git a/Dockerfile b/Dockerfile index dde9067..20c8732 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,23 @@ -# Use an official Go runtime as the base image -FROM golang:1.21 +# Use the official Golang image as the base image +FROM golang:1.20 # Set the working directory inside the container WORKDIR /app -# Copy the source code into the container +# Copy the Go module files +COPY go.mod go.sum ./ + +# Set Go proxy to goproxy.cn +RUN go env -w GOPROXY=https://goproxy.cn,direct + +# Download the Go module dependencies +RUN go mod download + +# Copy the rest of the application code COPY . . # Build the Go application RUN go build -o app # Set the entry point for the container -ENTRYPOINT ["./app"] \ No newline at end of file +CMD ["./app"] \ No newline at end of file