summaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorThomas E Lackey <telackey@bozemanpass.com>2023-04-11 04:58:12 +0200
committerJason Song <i@wolfogre.com>2023-04-11 04:58:12 +0200
commit5a8134410d44a521dffb81e334251035f0f90abf (patch)
tree2ffec5e31ae363862627cda8e8c2c30e2ca0e876 /Dockerfile
parentfeat: add artifact api from gitea server (#103) (diff)
downloadforgejo-runner-5a8134410d44a521dffb81e334251035f0f90abf.tar.xz
forgejo-runner-5a8134410d44a521dffb81e334251035f0f90abf.zip
Run as a container (#8) including Docker-in-Docker. (#84)
This adds a very simple Dockerfile and run script for running `act_runner` as a container. It also allows setting `Privileged` and `ContainerOptions` flags via the new config file when spawning task containers. The combination makes it possible to use Docker-in-Docker (which requires `privileged` mode) as well as pass any other options child Docker containers may require. For example, if Gitea is running in Docker on the same machine, for the `checkout` action to behave as expected from a task container launched by `act_runner`, it might be necessary to map the hostname via something like: ``` container: network_mode: bridge privileged: true options: --add-host=my.gitea.hostname:host-gateway ``` > NOTE: Description updated to reflect latest code. > NOTE: Description updated to reflect latest code (again). Reviewed-on: https://gitea.com/gitea/act_runner/pulls/84 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com> Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile17
1 files changed, 17 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..37c9354
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,17 @@
+FROM golang:alpine as builder
+RUN apk add --update-cache make git
+
+COPY . /opt/src/act_runner
+WORKDIR /opt/src/act_runner
+
+RUN make clean && make build
+
+FROM alpine as runner
+RUN apk add --update-cache \
+ git bash \
+ && rm -rf /var/cache/apk/*
+
+COPY --from=builder /opt/src/act_runner/act_runner /usr/local/bin/act_runner
+COPY run.sh /opt/act/run.sh
+
+ENTRYPOINT ["/opt/act/run.sh"]