mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-29 04:30:36 +00:00
disable starting the daemon on windows
This commit is contained in:
parent
98722a6680
commit
3336758708
@ -59,7 +59,7 @@ steps:
|
||||
commands:
|
||||
# TODO use the new DRONE_SEMVER_SHORT environment variables to
|
||||
# publish docker images for tag events.
|
||||
- go build -o release/windows/amd64/drone-docker.exe
|
||||
- go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker
|
||||
- docker login -u $env:USERNAME -p $env:PASSWORD
|
||||
- docker build -f docker/docker/Dockerfile.windows.1809 -t plugins/docker:windows-1809-amd64 .
|
||||
- docker push plugins/docker:windows-1809-amd64
|
||||
@ -97,7 +97,7 @@ steps:
|
||||
commands:
|
||||
# TODO use the new DRONE_SEMVER_SHORT environment variables to
|
||||
# publish docker images for tag events.
|
||||
- go build -o release/windows/amd64/drone-docker.exe
|
||||
- go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker
|
||||
- docker login -u $env:USERNAME -p $env:PASSWORD
|
||||
- docker build -f docker/docker/Dockerfile.windows.1903 -t plugins/docker:windows-1903-amd64 .
|
||||
- docker push plugins/docker:windows-1903-amd64
|
||||
|
26
daemon.go
Normal file
26
daemon.go
Normal file
@ -0,0 +1,26 @@
|
||||
// +build !windows
|
||||
|
||||
package docker
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
const dockerExe = "/usr/local/bin/docker"
|
||||
const dockerdExe = "/usr/local/bin/dockerd"
|
||||
|
||||
func (p Plugin) startDaemon() {
|
||||
cmd := commandDaemon(p.Daemon)
|
||||
if p.Daemon.Debug {
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
} else {
|
||||
cmd.Stdout = ioutil.Discard
|
||||
cmd.Stderr = ioutil.Discard
|
||||
}
|
||||
go func() {
|
||||
trace(cmd)
|
||||
cmd.Run()
|
||||
}()
|
||||
}
|
10
daemon_win.go
Normal file
10
daemon_win.go
Normal file
@ -0,0 +1,10 @@
|
||||
// +build windows
|
||||
|
||||
package docker
|
||||
|
||||
const dockerExe = "C:\\bin\\docker.exe"
|
||||
const dockerdExe = ""
|
||||
|
||||
func (p Plugin) startDaemon() {
|
||||
// this is a no-op on windows
|
||||
}
|
17
docker.go
17
docker.go
@ -2,7 +2,6 @@ package docker
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
@ -69,18 +68,7 @@ type (
|
||||
func (p Plugin) Exec() error {
|
||||
// start the Docker daemon server
|
||||
if !p.Daemon.Disabled {
|
||||
cmd := commandDaemon(p.Daemon)
|
||||
if p.Daemon.Debug {
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
} else {
|
||||
cmd.Stdout = ioutil.Discard
|
||||
cmd.Stderr = ioutil.Discard
|
||||
}
|
||||
go func() {
|
||||
trace(cmd)
|
||||
cmd.Run()
|
||||
}()
|
||||
p.startDaemon()
|
||||
}
|
||||
|
||||
// poll the docker daemon until it is started. This ensures the daemon is
|
||||
@ -154,9 +142,6 @@ func (p Plugin) Exec() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
const dockerExe = "/usr/local/bin/docker"
|
||||
const dockerdExe = "/usr/local/bin/dockerd"
|
||||
|
||||
// helper function to create the docker login command.
|
||||
func commandLogin(login Login) *exec.Cmd {
|
||||
if login.Email != "" {
|
||||
|
@ -13,7 +13,8 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl
|
||||
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||
RUN /innoextract.exe dockertoolbox.exe
|
||||
|
||||
FROM mcr.microsoft.com/windows/servercore:1903
|
||||
FROM mcr.microsoft.com/windows/nanoserver:1903
|
||||
USER ContainerAdministrator
|
||||
|
||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||
org.label-schema.name="Drone Docker" `
|
||||
@ -21,6 +22,7 @@ LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||
org.label-schema.schema-version="1.0"
|
||||
|
||||
RUN mkdir C:\bin
|
||||
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
|
||||
COPY --from=download /app/docker.exe C:/bin/docker.exe
|
||||
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
|
||||
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]
|
||||
|
Loading…
Reference in New Issue
Block a user