Closed konstantinzolotarev closed 1 year ago
I tied to build image locally, but got lot of issues with parcel
and it's dependencies.
Will try to do something when will have some free time.
BTW. Thank you very much for your hard work and wanted to say that smocker really helped our team !
Thanks for the kind words :)
On my side I tried creating a specific arm64v8 dockerfile (See Dockerfile.arm64v8 with the base images from the hub: https://hub.docker.com/u/arm64v8 but it didn't work (See build) and I'm not sure why. My guess is that I should try to build directly on an arm64 platform but I don't know if Github actions support that, I'll need to dig it. I also read some stuff about QEMU emulation with docker buildx but I fear that it'll be slow to build, and it's not really well documented
The github actions are promising though: https://github.com/docker/setup-buildx-action#with-qemu
It's fairly easy to build multiplatform images using buildx and github actions. Here is an example of a setup that doesn't require additional changes in Dockerfile (like custom arch argument to have a conditional flow for some binaries installations for example): https://github.com/andrcuns/allure-report-publisher/blob/main/.github/workflows/release.yml#L21
I could definitely benefit from arm image for local workflows on m1 macbook. Though the image does seem to work fine in emulation mode as well.
First of all thank you very much for Smocker. It helps me a lot! 👍🏻
Building a multi-platform image is fairly simply, as mentioned in other comments. You simply use Docker buildx as shown below.
docker buildx build --no-cache --platform linux/amd64,linux/arm64/v8 --tag thiht/smocker:0.18.2-deleteme .
Nevertheless, I was not able to build the client in Docker due to issues with yarn.
Without knowing how the client works, I think it is not required to be build in a Docker multi-stage build, since it is not a binary.
When I adjusted the Dockerfile a bit and prebuilding the client on my machine I was able to successfully a multi-arch Docker image with Docker buildx.
FROM golang:1.18-alpine AS build-backend
RUN apk add --no-cache make
ARG VERSION=snapshot
ARG COMMIT
WORKDIR /go/src/github.com/Thiht/smocker
COPY go.mod go.sum ./
RUN go mod download
COPY Makefile main.go ./
COPY server/ ./server/
RUN make VERSION=$VERSION COMMIT=$COMMIT RELEASE=1 build
FROM alpine
WORKDIR /opt
EXPOSE 8080 8081
COPY --from=build-backend /go/src/github.com/Thiht/smocker/build/* /opt/
# pick pre-built the client from the local filesystem (adjust .dockerignore)
COPY build/* /opt/
CMD ["/opt/smocker"]
Not sure if this helps, but I thought it me be helpful.
If you consider to change the way the Docker image is built, I could provide a PR adjusting your GitHub Action workflow and add QEMU to it.
@konstantinzolotarev you can still execute the Docker image but you need to install Rosetta 2. Add the parameter --platform=amd64
to your Docker run command.
docker run -d \
--platform=amd64
--restart=always \
-p 8080:8080 \
-p 8081:8081 \
--name smocker \
thiht/smocker
Should be ok now that #274 and #282 are merged
Excellent! It works. Thank you very much.
Could you please also release official ARM64v8 docker image ?