gangefors / docker-airdcpp-webclient

AirDC++ Web Client Docker image
https://hub.docker.com/r/gangefors/airdcpp-webclient/
MIT License
36 stars 13 forks source link

Build multi-arch image that includes ARM7 support #21

Open gangefors opened 3 years ago

gangefors commented 3 years ago

Use Github Actions and create images that are multi-arch.

Use the prebuilt binary that is available for AMR7. https://web-builds.airdcpp.net/stable/airdcpp_latest_master_armhf_portable.tar.gz

Eneris commented 2 years ago

Even if I manage to build it with arm binary, it dies with error when starting: FATAL: Can't start AirDC++ Web Client: Year is out of valid range: 1400..9999

gangefors commented 2 years ago

Related to #17. I have no idea as to why this problem occurs and I have no easy way of testing it either.

i5Js commented 10 months ago

Hey, Please let me know how I can help. I have an arm board running omv, and I'm trying to get it working.

i5Js commented 10 months ago

I'm using your Dockerfile, changing the x86 package by the arm, and I'm getting the following error:

[+] Building 3.2s (9/10)                                                                                                                                                                                                                           docker:default
 => [internal] load .dockerignore                                                                                                                                                                                                                            0.5s
 => => transferring context: 2B                                                                                                                                                                                                                              0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                         0.8s
 => => transferring dockerfile: 1.82kB                                                                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/debian:stable-slim                                                                                                                                                                                        0.9s
 => [1/6] FROM docker.io/library/debian:stable-slim@sha256:d4494b6af5eafd77c251e7eb1b5bfefc99a7b81172e80c30feb883898f7e5655                                                                                                                                  0.9s
 => => resolve docker.io/library/debian:stable-slim@sha256:d4494b6af5eafd77c251e7eb1b5bfefc99a7b81172e80c30feb883898f7e5655                                                                                                                                  0.9s
 => [internal] load build context                                                                                                                                                                                                                            0.4s
 => => transferring context: 35B                                                                                                                                                                                                                             0.0s
 => CACHED [2/6] RUN installDeps='         curl         gnupg     '     && runtimeDeps='         ca-certificates         locales         openssl     '     && export DEBIAN_FRONTEND=noninteractive     && apt-get update     && apt-get install -y --no-in  0.0s
 => CACHED [3/6] RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen     && locale-gen && dpkg-reconfigure -f noninteractive locales                                                                                                    0.0s
 => CACHED [4/6] RUN mkdir -p /.airdcpp /Downloads /Share     && chmod a+rwX /.airdcpp /Downloads /Share     && ln -sf /.airdcpp /airdcpp-webclient/config     && cd /airdcpp-webclient/web-resources     && ln -sf images/favicon.*.ico favicon.ico         0.0s
 => ERROR [5/6] COPY .airdcpp/ /.default-config                                                                                                                                                                                                              0.0s
------
 > [5/6] COPY .airdcpp/ /.default-config:
------
Dockerfile:52
--------------------
  50 |         && ln -sf images/favicon.*.ico favicon.ico
  51 |     
  52 | >>> COPY .airdcpp/ /.default-config
  53 |     COPY entrypoint.sh /entrypoint.sh
  54 |     EXPOSE 5600 5601 21248 21249
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 05a5bb10-e7d1-4ca2-9184-0245cacb8212::jxjekp0nu6dbd9q4lqppppc5c: "/.airdcpp": not found
gangefors commented 10 months ago

Have you cloned the repo and building from the root? The error indicates that you do not have the .airdcpp folder in your build context.

i5Js commented 10 months ago

Hey, thanks for answering.

Yes, you're right, I missed it. With omv is a bit different.

It's building now, let's see.

i5Js commented 10 months ago

Perhaps it's because OMV too, because I'm getting this one when I run the docker:

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/entrypoint.sh": permission denied: unknown.

i5Js commented 10 months ago

But I guess I have time issue too:

            "Error": "failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: \"/entrypoint.sh\": permission denied: unknown",
            "StartedAt": "0001-01-01T00:00:00Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
i5Js commented 10 months ago

Ok, I think the time issue is fixed:

sudo docker inspect 4e7f88604f73
[
    {
        "Id": "4e7f88604f73877711fd5d860faf193b548671b6d6b2e6fc502c22e84f7de917",
        "Created": "2024-01-10T13:18:11.000832976Z",
        "Path": "/entrypoint.sh",
        "Args": [],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 1,
            "Error": "",
            **"StartedAt": "2024-01-10T13:18:13.496457188Z",
            "FinishedAt": "2024-01-10T13:18:13.515522299Z"**

I have added RUN chmod +x entrypoint.sh and I can run the docker run command, but still exited with the same error:

sudo docker logs 05924a8d5e5a
/bin/bash: /entrypoint.sh: Permission denied
i5Js commented 9 months ago

Finally, after fixing the folders permissions in omv, I have the docker working.

I have just added the command RUN chmod +x entrypoint.sh, but I think it's not needed.

Is there anything you need to help you?

gangefors commented 9 months ago

It should be enough to update the COPY command to COPY --chmod=755 entrypoint.sh /entrypoint.sh instead of adding another RUN statement. Could you test that?

Strange that the file lost its execute permissions. I think it is checked in as such, but depending on the system that clones the files the execute permission might be lost. The above should solve it no matter why it happens.

The thing I need help with is creating a CI pipeline using github actions that is able to build a multiarch image so that the same container image name can be used no matter if it's an ARM or amd64 host architecture that wants to run it. https://docs.docker.com/build/ci/github-actions/multi-platform/ The pipeline I have now is a minimal attempt to build a 64bit image. But I want to get it to a state where I can build a multi-arch image using best practices. I just haven't had the time to dig into how to do that.

i5Js commented 9 months ago

I can confirm that chmod command is not needed. It was an issue with the folder permissions in omv.

msdos commented 4 months ago

I don't know if simply by adding qemu and platforms sections will do the magic, but I've seen some people using qemu for similar cases: https://github.com/mrgasparov/nicotine-novnc/blob/a37ecce9a272f50a4a9ae454eaf832bfd35bcb37/.github/workflows/docker-build.yml#L23 I'm using this image in a raspberrypi 4 armv8. Maybe if compiling everything instead of using pre-built binaries, or using env variables for the pre built arm and a condition in actions (don't even know if this is possible).

msdos commented 4 months ago
export dl_url="https://web-builds.airdcpp.net/stable/airdcpp_latest_master_armhf_portable.tar.gz"
docker build -t airdcpp-webclient-armv8-dl_url --no-cache --pull -t gangefors/airdcpp-webclient:2.7.0 --build-arg dl_url .                                                                                                                                             [23:16:58]
[+] Building 106.2s (11/11) FINISHED                                                                                                                                                                                                                                  docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                            0.0s
 => => transferring dockerfile: 1.66kB                                                                                                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/debian:stable-slim                                                                                                                                                                                                           2.4s
 => [internal] load .dockerignore                                                                                                                                                                                                                                               0.0s
 => => transferring context: 139B                                                                                                                                                                                                                                               0.0s
 => CACHED [1/6] FROM docker.io/library/debian:stable-slim@sha256:0200978f5b28cc795ec1699254fd789263193af9ab650bd2e4ef2bedf6cbd1c2                                                                                                                                              0.0s
 => [internal] load build context                                                                                                                                                                                                                                               0.0s
 => => transferring context: 148B                                                                                                                                                                                                                                               0.0s
 => [2/6] RUN installDeps='         curl         gnupg     '     && runtimeDeps='         ca-certificates         locales         openssl     '     && export DEBIAN_FRONTEND=noninteractive     && apt-get update     && apt-get install -y --no-install-recommends ${instal  78.3s
 => [3/6] RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen     && locale-gen && dpkg-reconfigure -f noninteractive locales                                                                                                                             16.8s 
 => [4/6] RUN mkdir -p /.airdcpp /Downloads /Share     && chmod a+rwX /.airdcpp /Downloads /Share     && ln -sf /.airdcpp /airdcpp-webclient/config     && cd /airdcpp-webclient/web-resources     && ln -sf images/favicon.*.ico favicon.ico                                   0.6s 
 => [5/6] COPY .airdcpp/ /.default-config                                                                                                                                                                                                                                       0.1s 
 => [6/6] COPY entrypoint.sh /entrypoint.sh                                                                                                                                                                                                                                     0.1s 
 => exporting to image                                                                                                                                                                                                                                                          7.7s 
 => => exporting layers                                                                                                                                                                                                                                                         7.6s 
 => => writing image sha256:d5a083195c26dc05eeed29b6dc9d518ff683bd6a729e7674b43bd4af12900719                                                                                                                                                                                    0.0s 
 => => naming to docker.io/library/airdcpp-webclient-armv8-dl_url                                                                                                                                                                                                               0.0s
 => => naming to docker.io/gangefors/airdcpp-webclient:2.7.0                                                                                                                                                                                                                    0.0s
>>> elapsed time 1m46s

On a raspberrypi 4 I can build as well.