Skip to content

Commit

Permalink
APPS-1433 Fix Docker build for arm64 in v2 (#294)
Browse files Browse the repository at this point in the history
* Release: v2.0.1
  • Loading branch information
davi17g authored Dec 31, 2024
1 parent 7234137 commit 0750c82
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
echo "TAG=$(cat VERSION | cut -c 2-)" >> $GITHUB_ENV
echo "ISO8601=$(LC_TIME=en_US.UTF-8 date "+%Y-%m-%dT%H:%M:%S%z")" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Setup Jfrog
Expand Down
29 changes: 14 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
# syntax=docker/dockerfile:1.7-labs
FROM registry.access.redhat.com/ubi9:latest as base
RUN dnf -y install make git && dnf clean all

# syntax=docker/dockerfile:1.12.0
ARG GO_VERSION=1.22.6
WORKDIR /app
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS builder

RUN arch=${TARGETARCH:-amd64} \
&& curl -Lo /tmp/go.tgz "https://go.dev/dl/go${GO_VERSION}.linux-${arch}.tar.gz" \
&& tar -xzf /tmp/go.tgz -C /usr/local/ \
&& rm /tmp/go.tgz
ARG TARGETOS
ARG TARGETARCH

FROM base as builder
ENV PATH="$PATH:/usr/local/go/bin"
ENV GOPATH=/app/aerospike-backup-service
ENV GOCACHE=/app/
COPY --from=xx / /

WORKDIR /app/aerospike-backup-service
COPY . .

RUN make build
RUN <<-EOF
xx-go --wrap
OS=${TARGETOS} ARCH=${TARGETARCH} make build
xx-verify /app/aerospike-backup-service/build/target/aerospike-backup-service_${TARGETOS}_${TARGETARCH}
EOF

FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
COPY --from=builder /app/aerospike-backup-service/build/target/aerospike-backup-service /usr/bin/aerospike-backup-service
ARG TARGETOS
ARG TARGETARCH
COPY --from=builder /app/aerospike-backup-service/build/target/aerospike-backup-service_${TARGETOS}_${TARGETARCH} /usr/bin/aerospike-backup-service
COPY --from=builder /app/aerospike-backup-service/config/config.yml /etc/aerospike-backup-service/aerospike-backup-service.yml

EXPOSE 8080
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.0.0
v2.0.1
12 changes: 3 additions & 9 deletions build/scripts/docker-buildx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ else
fi

docker login aerospike.jfrog.io -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx rm builder || true

docker buildx create --name builder --driver docker-container --use
docker buildx inspect --bootstrap

PLATFORMS="$PLATFORMS" \
TAG="$TAG" \
Expand All @@ -70,9 +65,8 @@ GIT_COMMIT_SHA="$(git rev-parse HEAD)" \
VERSION="$(cat "$WORKSPACE/VERSION")" \
ISO8601="$(LC_TIME=en_US.UTF-8 date "+%Y-%m-%dT%H:%M:%S%z")" \
CONTEXT="$WORKSPACE" \
docker buildx bake default \
docker buildx bake \
--allow=fs.read="$WORKSPACE" \
default \
--progress plain \
--file "$WORKSPACE/build/docker-build/docker-bake.hcl"

docker context use default
docker buildx rm builder
2 changes: 1 addition & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2573,7 +2573,7 @@ const docTemplate = `{

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "v2.0.0",
Version: "v2.0.1",
Host: "localhost:8080",
BasePath: "",
Schemes: []string{},
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"title" : "Backup Service REST API Specification",
"version" : "v2.0.0"
"version" : "v2.0.1"
},
"externalDocs" : {
"description" : "OpenAPI",
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ info:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: Backup Service REST API Specification
version: v2.0.0
version: v2.0.1
externalDocs:
description: OpenAPI
url: https://swagger.io/resources/open-api/
Expand Down
2 changes: 1 addition & 1 deletion internal/server/handlers/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package handlers

// Annotations to generate OpenAPI description (https://github.com/swaggo/swag)
// @title Backup Service REST API Specification
// @version v2.0.0
// @version v2.0.1
// @description Aerospike Backup Service
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
Expand Down

0 comments on commit 0750c82

Please sign in to comment.