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: with:
fetch-depth: 0 fetch-depth: 0
- run: echo "🛠️ The Gitea Actions workflow is now ready to test your code on the runner." - run: echo "🛠️ The Gitea Actions workflow is now ready to test your code on the runner."
- name: Install Go # - name: Install Go
run: | # run: |
apt-get update # apt-get update
apt-get install -y golang # apt-get install -y golang
- name: Set Go Proxy # - name: Set Go Proxy
run: go env -w GOPROXY=https://goproxy.cn,direct # run: go env -w GOPROXY=https://goproxy.cn,direct
- name: Build Docker image - name: Build Docker image
run: docker build -t my-docker-image . run: docker build -t my-docker-image .
- name: Deploy to local Docker - name: Deploy to local Docker

View File

@ -1,14 +1,23 @@
# Use an official Go runtime as the base image # Use the official Golang image as the base image
FROM golang:1.21 FROM golang:1.20
# Set the working directory inside the container # Set the working directory inside the container
WORKDIR /app 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 . . COPY . .
# Build the Go application # Build the Go application
RUN go build -o app RUN go build -o app
# Set the entry point for the container # Set the entry point for the container
ENTRYPOINT ["./app"] CMD ["./app"]