8
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m15s Details

This commit is contained in:
dm 2024-08-13 11:16:26 +08:00
parent 2e1c704518
commit 7af945e3f9
2 changed files with 19 additions and 10 deletions

View File

@ -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

View File

@ -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"]
CMD ["./app"]