Skip to content

Commit

Permalink
fix: correct typo in Dockerfiles for TARGETARCH
Browse files Browse the repository at this point in the history
We also enable the go-synethetic example application to run
cross-platform to match the rest of our binary Dockerfiles.
  • Loading branch information
pintohutch committed Nov 16, 2024
1 parent e9e06dd commit f4579b1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/config-reloader/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FROM --platform=$BUILDPLATFORM google-go.pkg.dev/golang:1.23.2@sha256:335533a0cbaa2e5b0dc038ac7023418ac68c3bb22b8828fc354088bb0340019b AS buildbase
ARG TARGETOS
ARG TAGETARCH
ARG TARGETARCH
WORKDIR /app
COPY go.mod go.mod
COPY go.sum go.sum
Expand Down
2 changes: 1 addition & 1 deletion cmd/datasource-syncer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FROM --platform=$BUILDPLATFORM google-go.pkg.dev/golang:1.23.2@sha256:335533a0cbaa2e5b0dc038ac7023418ac68c3bb22b8828fc354088bb0340019b AS buildbase
ARG TARGETOS
ARG TAGETARCH
ARG TARGETARCH
WORKDIR /app
COPY . ./

Expand Down
2 changes: 1 addition & 1 deletion cmd/operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FROM --platform=$BUILDPLATFORM google-go.pkg.dev/golang:1.23.2@sha256:335533a0cbaa2e5b0dc038ac7023418ac68c3bb22b8828fc354088bb0340019b AS buildbase
ARG TARGETOS
ARG TAGETARCH
ARG TARGETARCH
WORKDIR /app
COPY go.mod go.mod
COPY go.sum go.sum
Expand Down
2 changes: 1 addition & 1 deletion cmd/rule-evaluator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FROM --platform=$BUILDPLATFORM google-go.pkg.dev/golang:1.23.2@sha256:335533a0cbaa2e5b0dc038ac7023418ac68c3bb22b8828fc354088bb0340019b AS buildbase
ARG TARGETOS
ARG TAGETARCH
ARG TARGETARCH
WORKDIR /app
COPY go.mod go.mod
COPY go.sum go.sum
Expand Down
12 changes: 10 additions & 2 deletions examples/instrumentation/go-synthetic/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM google-go.pkg.dev/golang:1.23.2@sha256:335533a0cbaa2e5b0dc038ac7023418ac68c3bb22b8828fc354088bb0340019b AS buildbase
FROM --platform=$BUILDPLATFORM google-go.pkg.dev/golang:1.23.2@sha256:335533a0cbaa2e5b0dc038ac7023418ac68c3bb22b8828fc354088bb0340019b AS buildbase
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY . ./

FROM buildbase AS appbase

RUN CGO_ENABLED=0 GOEXPERIMENT=boringcrypto go build -o go-synthetic ./examples/instrumentation/go-synthetic
RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \
apt install -y --no-install-recommends \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross; \
CC=aarch64-linux-gnu-gcc; \
fi && \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=1 CC=${CC} \
go build -tags boring -mod=vendor -o go-synthetic -ldflags='-linkmode=external -extldflags=-static' ./examples/instrumentation/go-synthetic

FROM gcr.io/distroless/static-debian11:latest
COPY --from=appbase /app/go-synthetic /bin/go-synthetic
Expand Down

0 comments on commit f4579b1

Please sign in to comment.