summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-04-12 22:17:08 +0200
committertechknowlogick <techknowlogick@noreply.gitea.io>2023-04-12 22:17:08 +0200
commita05c5ba3ad5bc8f3ed8f31707a6c83eba60354d9 (patch)
tree6c84c3e1d258fe54fb58b8debb91f9821b118542
parentSet specific environments to distinguish between Gitea and GitHub (#113) (diff)
downloadforgejo-runner-a05c5ba3ad5bc8f3ed8f31707a6c83eba60354d9.tar.xz
forgejo-runner-a05c5ba3ad5bc8f3ed8f31707a6c83eba60354d9.zip
Add make docker (#115)
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/115 Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
-rw-r--r--Makefile8
-rw-r--r--README.md15
2 files changed, 21 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 139cc83..9bae70d 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,10 @@ WINDOWS_ARCHS ?= windows/amd64
GO_FMT_FILES := $(shell find . -type f -name "*.go" ! -name "generated.*")
GOFILES := $(shell find . -type f -name "*.go" -o -name "go.mod" ! -name "generated.*")
+DOCKER_IMAGE ?= gitea/act_runner
+DOCKER_TAG ?= nightly
+DOCKER_REF := $(DOCKER_IMAGE):$(DOCKER_TAG)
+
ifneq ($(shell uname), Darwin)
EXTLDFLAGS = -extldflags "-static" $(null)
else
@@ -156,6 +160,10 @@ release-check: | $(DIST_DIRS)
release-compress: | $(DIST_DIRS)
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && $(GO) run $(GXZ_PAGAGE) -k -9 $${file}; done;
+.PHONY: docker
+docker:
+ docker build --disable-content-trust=false -t $(DOCKER_REF) .
+
clean:
$(GO) clean -x -i ./...
rm -rf coverage.txt $(EXECUTABLE) $(DIST)
diff --git a/README.md b/README.md
index bc4578a..9e84b2a 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ Act runner is a runner for Gitea based on [Gitea fork](https://gitea.com/gitea/a
### Prerequisites
-Docker Engine Community version is required. To install Docker CE, follow the official [install instructions](https://docs.docker.com/engine/install/).
+Docker Engine Community version is required for docker mode. To install Docker CE, follow the official [install instructions](https://docs.docker.com/engine/install/).
### Download pre-built binary
@@ -18,6 +18,12 @@ Visit https://dl.gitea.com/act_runner/ and download the right version for your p
make build
```
+### Build a docker image
+
+```bash
+make docker
+```
+
## Quickstart
### Register
@@ -66,7 +72,6 @@ If the registry succeed, it will run immediately. Next time, you could run the r
./act_runner daemon
```
-
### Configuration
You can also configure the runner with a configuration file.
@@ -82,3 +87,9 @@ You can specify the configuration file path with `-c`/`--config` argument.
./act_runner -c config.yaml register # register with config file
./act_runner -c config.yaml deamon # run with config file
```
+
+### Run a docker container
+
+```sh
+docker run -e GITEA_INSTANCE_URL=http://192.168.8.18:3000 -e GITEA_RUNNER_REGISTRATION_TOKEN=<runner_token> -v /var/run/docker.sock:/var/run/docker.sock --name my_runner gitea/act_runner:nightly
+```