6 Commits

Author SHA1 Message Date
TP Honey
7888a798b1 Merge pull request #377 from tphoney/prep_20.14.0
(maint) prep for v20.14.0
2022-11-17 14:12:23 +00:00
TP Honey
8a12346d2f (maint) prep for v20.14.0 2022-11-17 14:03:02 +00:00
Dan Wilson
12be10a7ce Merge pull request #376 from tphoney/add_support_for_platform_flag
Add support for docker --platform flag
2022-11-17 13:37:40 +00:00
Marcelo E. Magallon
5a691ae1e4 Add support for docker --platform flag
Add a --platform flag so that the user can specify a value for the
corresponding flag passed to docker. This is useful in the context of
multi-arch builds and buildkit (DOCKER_BUILDKIT=1 in the environment).

Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
2022-11-17 13:31:29 +00:00
Don
0d40d7fa5a Remove arm builds 2022-09-30 16:33:31 -07:00
Don
a1fb315f3b Add ltsc2022 to docker manifest 2022-09-30 16:31:09 -07:00
8 changed files with 1145 additions and 50 deletions

1110
.drone.yml

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,17 @@
# Changelog
## [v20.14.0](https://github.com/drone-plugins/drone-docker/tree/v20.14.0) (2022-11-17)
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.13.0...v20.14.0)
**Implemented enhancements:**
- Add support for docker --platform flag [\#376](https://github.com/drone-plugins/drone-docker/pull/376) ([tphoney](https://github.com/tphoney))
**Fixed bugs:**
- Use full path to docker when creating card [\#373](https://github.com/drone-plugins/drone-docker/pull/373) ([donny-dont](https://github.com/donny-dont))
## [v20.13.0](https://github.com/drone-plugins/drone-docker/tree/v20.13.0) (2022-06-08)
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.12.0...v20.13.0)
@@ -8,6 +20,10 @@
- update docker linux amd64/arm64 to 20.10.14 [\#365](https://github.com/drone-plugins/drone-docker/pull/365) ([tphoney](https://github.com/tphoney))
**Merged pull requests:**
- v20.13.0 prep [\#367](https://github.com/drone-plugins/drone-docker/pull/367) ([tphoney](https://github.com/tphoney))
## [v20.12.0](https://github.com/drone-plugins/drone-docker/tree/v20.12.0) (2022-05-16)
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.11.0...v20.12.0)

View File

@@ -269,6 +269,11 @@ func main() {
Usage: "card path location to write to",
EnvVar: "DRONE_CARD_PATH",
},
cli.StringFlag{
Name: "platform",
Usage: "platform value to pass to docker",
EnvVar: "PLUGIN_PLATFORM",
},
}
if err := app.Run(os.Args); err != nil {
@@ -312,6 +317,7 @@ func run(c *cli.Context) error {
SecretFiles: c.StringSlice("secrets-from-file"),
AddHost: c.StringSlice("add-host"),
Quiet: c.Bool("quiet"),
Platform: c.String("platform"),
},
Daemon: docker.Daemon{
Registry: c.String("docker.registry"),

View File

@@ -63,6 +63,7 @@ type (
SecretFiles []string // Docker build secrets with file as source
AddHost []string // Docker build add-host
Quiet bool // Docker build quiet
Platform string // Docker build platform
}
// Plugin defines the Docker plugin parameters.
@@ -324,6 +325,9 @@ func commandBuild(build Build) *exec.Cmd {
if build.Quiet {
args = append(args, "--quiet")
}
if build.Platform != "" {
args = append(args, "--platform", build.Platform)
}
if build.AutoLabel {
labelSchema := []string{

View File

@@ -1,28 +0,0 @@
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2022 as download
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV DOCKER_VERSION 19.03.1
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.7-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
Remove-Item -Path innoextract.zip
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
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/nanoserver:ltsc2022
USER ContainerAdministrator
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
org.label-schema.name="Drone Docker" `
org.label-schema.vendor="Drone.IO Community" `
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" ]

View File

@@ -47,3 +47,9 @@ manifests:
architecture: amd64
os: windows
version: 1909
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
platform:
architecture: amd64
os: windows
version: ltsc2022

View File

@@ -114,6 +114,27 @@ func TestCommandBuild(t *testing.T) {
".",
),
},
{
name: "platform argument",
build: Build{
Name: "plugins/drone-docker:latest",
Dockerfile: "Dockerfile",
Context: ".",
Platform: "test/platform",
},
want: exec.Command(
dockerExe,
"build",
"--rm=true",
"-f",
"Dockerfile",
"-t",
"plugins/drone-docker:latest",
".",
"--platform",
"test/platform",
),
},
}
for _, tc := range tcs {

View File

@@ -20,8 +20,8 @@ echo $env:VERSION
echo $env:REGISTRY
# build the binary
#Write-Host "+ go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}";
#go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}
Write-Host "+ go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}";
go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}
# build and publish the docker image
docker login -u ${env:USERNAME} -p ${env:PASSWORD}