mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-11 17:50:58 +00:00
Add option to run custom architecture (container platform) (#525)
* Add QEMU to run different architectures * Update dependencies in `go.mod` * Add `--container-architecture` flag to specify custom image architecture Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
parent
195e84f0fd
commit
391acea9e2
13 changed files with 279 additions and 111 deletions
|
@ -11,11 +11,11 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/nektos/act/pkg/container"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/nektos/act/pkg/common"
|
||||
"github.com/nektos/act/pkg/container"
|
||||
"github.com/nektos/act/pkg/model"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// RunContext contains info about current job
|
||||
|
@ -89,6 +89,10 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
|||
binds = append(binds, fmt.Sprintf("%s:%s%s", rc.Config.Workdir, "/github/workspace", bindModifiers))
|
||||
}
|
||||
|
||||
if rc.Config.ContainerArchitecture == "" {
|
||||
rc.Config.ContainerArchitecture = fmt.Sprintf("%s/%s", "linux", runtime.GOARCH)
|
||||
}
|
||||
|
||||
rc.JobContainer = container.NewContainer(&container.NewContainerInput{
|
||||
Cmd: nil,
|
||||
Entrypoint: []string{"/usr/bin/tail", "-f", "/dev/null"},
|
||||
|
@ -107,6 +111,7 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
|||
Stderr: logWriter,
|
||||
Privileged: rc.Config.Privileged,
|
||||
UsernsMode: rc.Config.UsernsMode,
|
||||
Platform: rc.Config.ContainerArchitecture,
|
||||
})
|
||||
|
||||
var copyWorkspace bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue