Skip to content

Commit cf83ac2

Browse files
committed
Update Dockerfiles to set default TARGETPLATFORM and simplify multi-arch support
1 parent 14b50fc commit cf83ac2

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

docker/Dockerfile

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Declare the target platform to support multi-arch builds
2-
ARG TARGETPLATFORM
2+
ARG TARGETPLATFORM=linux/amd64
33

44
# To make sure we have the node, and golang binaries
5-
FROM --platform=$TARGETPLATFORM node:20.17.0-bookworm AS node
6-
FROM --platform=$TARGETPLATFORM golang:1.23.1-bookworm AS golang
5+
FROM node:20.17.0-bookworm AS node
6+
FROM golang:1.23.1-bookworm AS golang
77

88
# Set the base image, general environment variables, and move to temp dir
9-
FROM --platform=$TARGETPLATFORM debian:12.7
10-
RUN echo "Building for $TARGETPLATFORM"
9+
FROM debian:12.7
10+
ARG TARGETPLATFORM
11+
RUN echo "Building for ${TARGETPLATFORM}"
1112
ENV DEBIAN_FRONTEND="noninteractive"
1213
ENV GOBIN="/usr/local/go-bin"
1314
ENV PATH="$PATH:/usr/local/go-bin:/usr/local/dl-bin:/usr/local/go/bin"
@@ -37,7 +38,7 @@ RUN apt update && apt install -y postgresql-common && \
3738
# Install downloadable binaries
3839
RUN set -e && \
3940
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
40-
echo "Downloading arm64 binaries" \
41+
echo "Downloading arm64 binaries" && \
4142
# Install task
4243
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_arm64.tar.gz && \
4344
tar -xzf task_linux_arm64.tar.gz && \
@@ -54,7 +55,7 @@ RUN set -e && \
5455
tar -xzf golangci-lint-1.60.3-linux-arm64.tar.gz && \
5556
mv ./golangci-lint-1.60.3-linux-arm64/golangci-lint /usr/local/dl-bin/golangci-lint; \
5657
else \
57-
echo "Downloading amd64 binaries" \
58+
echo "Downloading amd64 binaries" && \
5859
# Install task
5960
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_amd64.tar.gz && \
6061
tar -xzf task_linux_amd64.tar.gz && \

docker/Dockerfile.cicd

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Declare the target platform to support multi-arch builds
2-
ARG TARGETPLATFORM
2+
ARG TARGETPLATFORM=linux/amd64
33

44
# To make sure we have the node, and golang binaries
5-
FROM --platform=$TARGETPLATFORM node:20.17.0-bookworm AS node
6-
FROM --platform=$TARGETPLATFORM golang:1.23.1-bookworm AS golang
5+
FROM node:20.17.0-bookworm AS node
6+
FROM golang:1.23.1-bookworm AS golang
77

88
# Set the base image, general environment variables, and move to temp dir
9-
FROM --platform=$TARGETPLATFORM debian:12.7
10-
RUN echo "Building for $TARGETPLATFORM"
9+
FROM debian:12.7
10+
ARG TARGETPLATFORM
11+
RUN echo "Building for ${TARGETPLATFORM}"
1112
ENV DEBIAN_FRONTEND="noninteractive"
1213
ENV GOBIN="/usr/local/go-bin"
1314
ENV PATH="$PATH:/usr/local/go-bin:/usr/local/dl-bin:/usr/local/go/bin"
@@ -37,7 +38,7 @@ RUN apt update && apt install -y postgresql-common && \
3738
# Install downloadable binaries
3839
RUN set -e && \
3940
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
40-
echo "Downloading arm64 binaries" \
41+
echo "Downloading arm64 binaries" && \
4142
# Install task
4243
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_arm64.tar.gz && \
4344
tar -xzf task_linux_arm64.tar.gz && \
@@ -54,7 +55,7 @@ RUN set -e && \
5455
tar -xzf golangci-lint-1.60.3-linux-arm64.tar.gz && \
5556
mv ./golangci-lint-1.60.3-linux-arm64/golangci-lint /usr/local/dl-bin/golangci-lint; \
5657
else \
57-
echo "Downloading amd64 binaries" \
58+
echo "Downloading amd64 binaries" && \
5859
# Install task
5960
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_amd64.tar.gz && \
6061
tar -xzf task_linux_amd64.tar.gz && \

docker/Dockerfile.dev

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Declare the target platform to support multi-arch builds
2-
ARG TARGETPLATFORM
2+
ARG TARGETPLATFORM=linux/amd64
33

44
# To make sure we have the node, and golang binaries
5-
FROM --platform=$TARGETPLATFORM node:20.17.0-bookworm AS node
6-
FROM --platform=$TARGETPLATFORM golang:1.23.1-bookworm AS golang
5+
FROM node:20.17.0-bookworm AS node
6+
FROM golang:1.23.1-bookworm AS golang
77

88
# Set the base image, general environment variables, and move to temp dir
9-
FROM --platform=$TARGETPLATFORM debian:12.7
10-
RUN echo "Building for $TARGETPLATFORM"
9+
FROM debian:12.7
10+
ARG TARGETPLATFORM
11+
RUN echo "Building for ${TARGETPLATFORM}"
1112
ENV DEBIAN_FRONTEND="noninteractive"
1213
ENV GOBIN="/usr/local/go-bin"
1314
ENV PATH="$PATH:/usr/local/go-bin:/usr/local/dl-bin:/usr/local/go/bin"
@@ -37,7 +38,7 @@ RUN apt update && apt install -y postgresql-common && \
3738
# Install downloadable binaries
3839
RUN set -e && \
3940
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
40-
echo "Downloading arm64 binaries" \
41+
echo "Downloading arm64 binaries" && \
4142
# Install task
4243
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_arm64.tar.gz && \
4344
tar -xzf task_linux_arm64.tar.gz && \
@@ -54,7 +55,7 @@ RUN set -e && \
5455
tar -xzf golangci-lint-1.60.3-linux-arm64.tar.gz && \
5556
mv ./golangci-lint-1.60.3-linux-arm64/golangci-lint /usr/local/dl-bin/golangci-lint; \
5657
else \
57-
echo "Downloading amd64 binaries" \
58+
echo "Downloading amd64 binaries" && \
5859
# Install task
5960
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_amd64.tar.gz && \
6061
tar -xzf task_linux_amd64.tar.gz && \

0 commit comments

Comments
 (0)