Just so you know, I have went through countless Stackoverflow questions about this and have tried everything and it seems nothing is working for me. I have tried adding the shebang, added --platform=linux/arm64 in the FROM in the Dockerfile etc.
My issue is rather simple.
Dockerfile
FROM node:20.3.0-alpine3.18
RUN apk update
RUN apk add openssl
On my laptop, I build the image for an ARM architecture server like this:
docker buildx build -t packagename:latest --platform linux/arm64 .
It works just fine. However, when I run the same in the Gitlab pipeline, I get the following error:
RUN apk update
exec /bin/sh: exec format error
ERROR: process "/bin/sh -c apk update" did not complete successfully: exit code: 1
My laptop where this works without any issues:
- Apple M2 Macbook Air
- Docker version 23.0.5, build bc4487a
Gitlab Runner:
- Ubuntu Server with linux/amd64 architecture
- Docker version 23.0.5, build bc4487a
Here is my .gitlab-ci.yml file
image: node:20.3.0-alpine3.18
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
stages:
- build
build-container-dev:
stage: build
image: docker:23.0.5
services:
- docker:23.0.5-dind
script:
- docker buildx build -t testrepo:latest --platform linux/arm64 .
Really in need of some help here. Thanks in advance!