mgob icon indicating copy to clipboard operation
mgob copied to clipboard

Docker images for arm64

Open tyteen4a03 opened this issue 1 year ago • 3 comments
trafficstars

Hi, would it be possible to get images for linux/arm64?

tyteen4a03 avatar Jul 11 '24 15:07 tyteen4a03

Hey, this is a temporal form to get the image:

  1. Clone repo
  2. Modify Dockerfile like this:
ARG MONGODB_TOOLS_VERSION=100.8.0
ARG EN_AWS_CLI=false
ARG AWS_CLI_VERSION=1.29.44
ARG EN_AZURE=false
ARG AZURE_CLI_VERSION=2.52.0
ARG EN_GCLOUD=false
ARG GOOGLE_CLOUD_SDK_VERSION=445.0.0
ARG EN_GPG=true
ARG GNUPG_VERSION="2.4.3-r1"
ARG EN_MINIO=false
ARG EN_RCLONE=false
ARG VERSION

FROM golang:1.21 as mgob-builder
ARG VERSION
COPY . /go/src/github.com/stefanprodan/mgob
WORKDIR /go/src/github.com/stefanprodan/mgob

RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.version=$VERSION" -a -installsuffix cgo -o mgob github.com/stefanprodan/mgob/cmd/mgob

FROM alpine:3.18
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
ARG MONGODB_TOOLS_VERSION
ARG AWS_CLI_VERSION
ARG AZURE_CLI_VERSION
ARG GOOGLE_CLOUD_SDK_VERSION
ARG GNUPG_VERSION
ARG EN_AWS_CLI
ARG EN_AZURE
ARG EN_GCLOUD
ARG EN_GPG
ARG EN_MINIO
ARG EN_RCLONE
ENV MONGODB_TOOLS_VERSION=$MONGODB_TOOLS_VERSION \
    GNUPG_VERSION=$GNUPG_VERSION \
    GOOGLE_CLOUD_SDK_VERSION=$GOOGLE_CLOUD_SDK_VERSION \
    AZURE_CLI_VERSION=$AZURE_CLI_VERSION \
    AWS_CLI_VERSION=$AWS_CLI_VERSION \
    MGOB_EN_AWS_CLI=$EN_AWS_CLI \
    MGOB_EN_AZURE=$EN_AZURE \
    MGOB_EN_GCLOUD=$EN_GCLOUD \
    MGOB_EN_GPG=$EN_GPG \
    MGOB_EN_MINIO=$EN_MINIO \
    MGOB_EN_RCLONE=$EN_RCLONE
    
RUN apk add --no-cache gnupg
RUN apk add --no-cache mongodb-tools
WORKDIR /

COPY build.sh /tmp
RUN /tmp/build.sh
ENV PATH="/google-cloud-sdk/bin:${PATH}"
COPY --from=mgob-builder /go/src/github.com/stefanprodan/mgob/mgob .
#COPY --from=tools-builder /go/mongo-tools/bin/* /usr/bin/

VOLUME ["/config", "/storage", "/tmp", "/data"]

LABEL org.label-schema.build-date=$BUILD_DATE \
      org.label-schema.name="mgob" \
      org.label-schema.description="MongoDB backup automation tool" \
      org.label-schema.url="https://github.com/stefanprodan/mgob" \
      org.label-schema.vcs-ref=$VCS_REF \
      org.label-schema.vcs-url="https://github.com/stefanprodan/mgob" \
      org.label-schema.vendor="stefanprodan.com,maxisam" \
      org.label-schema.version=$VERSION \
      org.label-schema.schema-version="1.0"

ENTRYPOINT [ "./mgob" ]
  1. Login to your registry docker login -u registry registry.local.com
  2. Build image docker buildx build --build-arg EN_AWS_CLI=true --build-arg EN_AZURE=true --build-arg EN_GCLOUD=true --build-arg EN_MINIO=true --build-arg EN_RCLONE=true --build-arg EN_GPG=true --platform linux/amd64,linux/arm64 --pull . -f ./Dockerfile --provenance=false --tag registry.local.com/maxisam/mgob:arm64 --push
  3. Change image tag by registry.local.com/maxisam/mgob:arm64 in your docker-compose.yml
  4. (Optional) if need tools like minio, rclone also modify build.sh to download the ARM64 versions

BakasuraRCE avatar Aug 13 '24 00:08 BakasuraRCE

I tried to add Arm64 into the build workflow but somehow it doesn't work for mongo tool for some reason.

https://github.com/maxisam/mgob/actions/runs/10600705132/job/29378803190

Welcome to make a PR for this Thanks!

maxisam avatar Aug 28 '24 17:08 maxisam

Hi @maxisam!

You need to take some extra steps to support the platform: https://github.com/mongodb/mongo-tools/blob/master/PLATFORMSUPPORT.md

However, they are a bit confusing, at least for me. In fact, I left them out of the equation and used the pre-built Alpine package.

RUN apk add --no-cache mongodb-tools

BakasuraRCE avatar Aug 30 '24 13:08 BakasuraRCE

do you have any update for the arm support?

no, welcome to make a PR, I don't even have arm device

maxisam avatar Nov 01 '24 14:11 maxisam

https://hub.docker.com/layers/maxisam/mgob/dev.322/images/sha256-40e81deb6fe1e9caf0de0e0abfa969a66d70428029f17ba35e33add2101897f7?context=repo

please verify this image. If it works, I will make an official release

Thanks!

maxisam avatar Nov 09 '24 19:11 maxisam

@maxisam Its running on Oracle Cloud ARM instance: a769183ac51b maxisam/mgob:dev.322 "/usr/local/bin/mgob…" 42 seconds ago Up 38 seconds

docker logs a769183ac51b
time="2024-11-09T19:33:41Z" level=info msg="mgob dev.322"
time="2024-11-09T19:33:41Z" level=info msg="starting with config: &{LogLevel:info JSONLog:false Host: Port:8090 ConfigPath:/config StoragePath:/storage TmpPath:/tmp DataPath:/data Version:dev.322 UseAwsCli:false HasGpg:false}"
time="2024-11-09T19:33:41Z" level=info msg="mongodump version: 100.8.0 git version: alpine Go version: go1.22.8    os: linux    arch: arm64    compiler: gc "
time="2024-11-09T19:33:41Z" level=info msg="mc version RELEASE.2024-11-05T11-29-45Z (commit-id=6ac18619cf881074fe6edcc79ab62c9c85da60b9) Runtime: go1.23.3 linux/arm64 Copyright (c) 2015-2024 MinIO, Inc. License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html> "
time="2024-11-09T19:33:42Z" level=info msg="aws-cli/1.29.44 Python/3.11.10 Linux/6.5.0-1023-oracle botocore/1.31.44 "
time="2024-11-09T19:33:42Z" level=info msg="gpg (GnuPG) 2.4.4 libgcrypt 1.10.2 Copyright (C) 2024 g10 Code GmbH License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.  Home: /root/.gnupg Supported algorithms: Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,         CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression: Uncompressed, ZIP, ZLIB, BZIP2 "
time="2024-11-09T19:33:43Z" level=info msg="Google Cloud SDK 499.0.0 bq 2.1.9 core 2024.10.25 gcloud-crc32c 1.0.0 gsutil 5.31 "
time="2024-11-09T19:33:43Z" level=info msg="WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade' azure-cli                         2.63.0 * "
time="2024-11-09T19:33:44Z" level=info msg="rclone v1.68.1 "
time="2024-11-09T19:33:44Z" level=info msg="Next tmp cleanup run at 2024-11-09 20:00:00 +0000 UTC"
time="2024-11-09T19:33:44Z" level=info msg="Next run at 2024-11-10 00:00:00 +0000 UTC" plan=backup-plan
time="2024-11-09T19:33:44Z" level=info msg="Starting HTTP server on port 8090"
lscpu
Architecture:           aarch64
  CPU op-mode(s):       32-bit, 64-bit
  Byte Order:           Little Endian
CPU(s):                 4
  On-line CPU(s) list:  0-3
Vendor ID:              ARM
  Model name:           Neoverse-N1
    Model:              1
    Thread(s) per core: 1
    Core(s) per socket: 4
    Socket(s):          1
    Stepping:           r3p1
    BogoMIPS:           50.00
    Flags:              fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
NUMA:
  NUMA node(s):         1
  NUMA node0 CPU(s):    0-3
Vulnerabilities:
  Gather data sampling: Not affected
  Itlb multihit:        Not affected
  L1tf:                 Not affected
  Mds:                  Not affected
  Meltdown:             Not affected
  Mmio stale data:      Not affected
  Retbleed:             Not affected
  Spec rstack overflow: Not affected
  Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:           Mitigation; __user pointer sanitization
  Spectre v2:           Mitigation; CSV2, BHB
  Srbds:                Not affected
  Tsx async abort:      Not affected

Thanks @danielchristianschroeter

Here is the release https://github.com/maxisam/mgob/releases/tag/2.0.26

maxisam avatar Nov 10 '24 05:11 maxisam