-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add procs config field, add gitea act_runner example
- Loading branch information
Showing
15 changed files
with
351 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Dockerfile | ||
.git | ||
autoscaler-proxy | ||
cloud-init.yml | ||
dev.env | ||
config.yml | ||
variables.yml | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Build act_runner image | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: example/act_runner/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
autoscaler-proxy | ||
cloud-init.yml | ||
dev.env | ||
config.yml | ||
/config.yml | ||
variables.yml | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM golang:1.21-alpine as runner | ||
|
||
WORKDIR /build | ||
|
||
RUN apk add make git | ||
|
||
RUN git clone https://gitea.com/gitea/act_runner.git . && git reset --hard d07fbfc8c3 | ||
|
||
COPY ./example/act_runner/docker-client-ping.patch . | ||
|
||
RUN git apply docker-client-ping.patch | ||
|
||
RUN make build | ||
|
||
FROM golang:1.21-alpine as proxy | ||
|
||
WORKDIR /build | ||
|
||
COPY . . | ||
|
||
RUN go build . | ||
|
||
FROM alpine | ||
|
||
RUN mkdir /app /data && chown 10000:10000 /app /data | ||
|
||
USER 10000 | ||
|
||
WORKDIR /data | ||
|
||
COPY --from=runner /build/act_runner /usr/bin/act_runner | ||
COPY --from=proxy /build/autoscaler-proxy /usr/bin/autoscaler-proxy | ||
|
||
COPY ./example/act_runner/config.yml /app/config.yml | ||
|
||
ENTRYPOINT ["autoscaler-proxy", "/app/config.yml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
listen_addr: | ||
127.0.0.1:8081: | ||
net: unix | ||
addr: /var/run/docker.sock | ||
name: docker | ||
procs: | ||
env: | ||
GITEA_INSTANCE: "${env.GITEA_INSTANCE}" | ||
GITEA_TOKEN: "${env.GITEA_TOKEN}" | ||
DOCKER_HOST: "tcp://${autoscaler.listen.docker}" | ||
run: | ||
- test -f .runner || act_runner register --instance $GITEA_INSTANCE --token $GITEA_TOKEN --no-interactive; act_runner daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
diff --git a/internal/pkg/envcheck/docker.go b/internal/pkg/envcheck/docker.go | ||
index 0a634ad..173b53a 100644 | ||
--- a/internal/pkg/envcheck/docker.go | ||
+++ b/internal/pkg/envcheck/docker.go | ||
@@ -5,30 +5,30 @@ package envcheck | ||
|
||
import ( | ||
"context" | ||
- "fmt" | ||
+ // "fmt" | ||
|
||
- "github.com/docker/docker/client" | ||
+ // "github.com/docker/docker/client" | ||
) | ||
|
||
func CheckIfDockerRunning(ctx context.Context, configDockerHost string) error { | ||
- opts := []client.Opt{ | ||
- client.FromEnv, | ||
- } | ||
- | ||
- if configDockerHost != "" { | ||
- opts = append(opts, client.WithHost(configDockerHost)) | ||
- } | ||
- | ||
- cli, err := client.NewClientWithOpts(opts...) | ||
- if err != nil { | ||
- return err | ||
- } | ||
- defer cli.Close() | ||
- | ||
- _, err = cli.Ping(ctx) | ||
- if err != nil { | ||
- return fmt.Errorf("cannot ping the docker daemon, does it running? %w", err) | ||
- } | ||
+ // opts := []client.Opt{ | ||
+ // client.FromEnv, | ||
+ // } | ||
+ | ||
+ // if configDockerHost != "" { | ||
+ // opts = append(opts, client.WithHost(configDockerHost)) | ||
+ // } | ||
+ | ||
+ // cli, err := client.NewClientWithOpts(opts...) | ||
+ // if err != nil { | ||
+ // return err | ||
+ // } | ||
+ // defer cli.Close() | ||
+ | ||
+ // _, err = cli.Ping(ctx) | ||
+ // if err != nil { | ||
+ // return fmt.Errorf("cannot ping the docker daemon, does it running? %w", err) | ||
+ // } | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
listen_addr: | ||
127.0.0.1:8081: | ||
net: unix | ||
addr: /var/run/docker.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.