Skip to content

Commit 31d5210

Browse files
committed
Move TARGET/BUILD PLATFORM higher in Dockerfiles
This is a partial fix for #232 where "docker build" could not override the two variables for multi-arch builds and caused a user error for building on an arm device. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 05a3ea5 commit 31d5210

File tree

8 files changed

+26
-8
lines changed

8 files changed

+26
-8
lines changed

template/go/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
ARG TARGETPLATFORM
2+
ARG BUILDPLATFORM
3+
ARG TARGETOS
4+
ARG TARGETARCH
5+
16
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
27
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.13-alpine3.12 as builder
38

49
# Required to enable Go modules
510
RUN apk add --no-cache git
611

7-
ARG TARGETPLATFORM
8-
ARG BUILDPLATFORM
9-
ARG TARGETOS
10-
ARG TARGETARCH
11-
1212
# Allows you to add additional packages via build-arg
1313
ARG ADDITIONAL_PACKAGE
1414
ARG CGO_ENABLED=0

template/node/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ARG TARGETPLATFORM
2+
ARG BUILDPLATFORM
3+
14
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
25
FROM --platform=${TARGETPLATFORM:-linux/amd64} node:12-alpine as ship
36

template/node12/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ARG TARGETPLATFORM
2+
ARG BUILDPLATFORM
3+
14
FROM --platform=${TARGETPLATFORM:-linux/amd64} openfaas/of-watchdog:0.7.2 as watchdog
25
FROM --platform=${TARGETPLATFORM:-linux/amd64} node:12-alpine as ship
36

template/php7/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ARG TARGETPLATFORM
2+
ARG BUILDPLATFORM
3+
14
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
25

36
# start with the official Composer image and name it

template/python/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
1+
ARG TARGETPLATFORM
2+
ARG BUILDPLATFORM
23

4+
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
35
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:2.7-alpine
46

57
# Allows you to add additional packages via build-arg

template/python3-debian/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ARG TARGETPLATFORM
2+
ARG BUILDPLATFORM
3+
14
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
25
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:3
36

template/python3/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
1+
ARG TARGETPLATFORM
2+
ARG BUILDPLATFORM
23

4+
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
35
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:3-alpine
46

57
# Allows you to add additional packages via build-arg

template/ruby/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
1+
ARG TARGETPLATFORM
2+
ARG BUILDPLATFORM
23

4+
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.1.4 as watchdog
35
FROM --platform=${TARGETPLATFORM:-linux/amd64} ruby:alpine
46

57
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog

0 commit comments

Comments
 (0)