podsync icon indicating copy to clipboard operation
podsync copied to clipboard

Add Docker image for ARM builds

Open mxpv opened this issue 4 years ago • 11 comments

ref https://github.com/mxpv/podsync/issues/48

mxpv avatar Nov 25 '19 04:11 mxpv

waiting for a docker arm image

pblgomez avatar Jan 01 '20 14:01 pblgomez

I created a Dockerfile that works on arm32v7

https://github.com/pblgomez/PodSync-Armv6-Docker

with build.sh it install latest Podsync and builds the docker image

pblgomez avatar Feb 01 '20 14:02 pblgomez

Thanks a lot! I have been waiting for this for a few weeks. I have just built the image in my rpi4 and it works like a charm!!! :)

pinano avatar Feb 01 '20 17:02 pinano

I waited too, but couldn't wait any longer jejeje. Hope @mxpv uses this and makes a official arm docker.

pblgomez avatar Feb 01 '20 18:02 pblgomez

Hi. @pblgomez thanks for the reference. I'll get to this eventually :)

mxpv avatar Feb 02 '20 05:02 mxpv

@pblgomez Hi! First of all, thank you very much. The build process went fine. But I ran into an issue at startup.

time="2020-04-15T13:35:04Z" level=info msg="\n _______  _______  ______   _______           _        _______ \n(  ____ )(  ___  )(  __  \\ (  ____ \\|\\     /|( (    /|(  ____ \\\n| (    )|| (   ) || (  \\  )| (    \\/( \\   / )|  \\  ( || (    \\/\n| (____)|| |   | || |   ) || (_____  \\ (_) / |   \\ | || |      \n|  _____)| |   | || |   | |(_____  )  \\   /  | (\\ \\) || |      \n| (      | |   | || |   ) |      ) |   ) (   | | \\   || |      \n| )      | (___) || (__/  )/\\____) |   | |   | )  \\  || (____/\\\n|/       (_______)(______/ \\_______)   \\_/   |/    )_)(_______/\n"
time="2020-04-15T13:35:04Z" level=info msg="running podsync" commit=26e3ed40bfbd2138350b611f60cfdc6f55b7a266 date="2020-04-14T17:41:37Z" version=2.1.1
time="2020-04-15T13:35:09Z" level=info msg="using youtube-dl 2020.03.24\n"
time="2020-04-15T13:35:09Z" level=info msg="using ffmpeg ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers\nbuilt with gcc 9.2.0 (Alpine 9.2.0)\nconfiguration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug\nlibavutil      56. 31.100 / 56. 31.100\nlibavcodec     58. 54.100 / 58. 54.100\nlibavformat    58. 29.100 / 58. 29.100\nlibavdevice    58.  8.100 / 58.  8.100\nlibavfilter     7. 57.100 /  7. 57.100\nlibavresample   4.  0.  0 /  4.  0.  0\nlibswscale      5.  5.100 /  5.  5.100\nlibswresample   3.  5.100 /  3.  5.100\nlibpostproc    55.  5.100 / 55.  5.100\n"
time="2020-04-15T13:35:09Z" level=info msg="opening database \"db\""
time="2020-04-15T13:35:09Z" level=info msg="All 0 tables opened in 0s\n"
time="2020-04-15T13:35:09Z" level=fatal msg="failed to open database" error="failed to open database: Mmap value log file. Path=db/000000.vlog. Error=cannot allocate memory"

I'm on the Pi 2 Model B v1.1

melgu avatar Apr 15 '20 13:04 melgu

Yes, I tried too and it fails, something changed in this latest release. Try to build it with v2.0.7 @mxpv Can you tell me what changed level=fatal msg="failed to open database" error="could not mkdir database dir: mkdir db: permission denied" Glad I could help

The problem exist with 2.1.0 and newer.

@melgu There's a branch on my github to keep using 2.0.7 till this is fixed. Use that one till then. ;)

pblgomez avatar Apr 16 '20 12:04 pblgomez

@pblgomez Hi! First of all, thank you very much. The build process went fine. But I ran into an issue at startup.

time="2020-04-15T13:35:04Z" level=info msg="\n _______  _______  ______   _______           _        _______ \n(  ____ )(  ___  )(  __  \\ (  ____ \\|\\     /|( (    /|(  ____ \\\n| (    )|| (   ) || (  \\  )| (    \\/( \\   / )|  \\  ( || (    \\/\n| (____)|| |   | || |   ) || (_____  \\ (_) / |   \\ | || |      \n|  _____)| |   | || |   | |(_____  )  \\   /  | (\\ \\) || |      \n| (      | |   | || |   ) |      ) |   ) (   | | \\   || |      \n| )      | (___) || (__/  )/\\____) |   | |   | )  \\  || (____/\\\n|/       (_______)(______/ \\_______)   \\_/   |/    )_)(_______/\n"
time="2020-04-15T13:35:04Z" level=info msg="running podsync" commit=26e3ed40bfbd2138350b611f60cfdc6f55b7a266 date="2020-04-14T17:41:37Z" version=2.1.1
time="2020-04-15T13:35:09Z" level=info msg="using youtube-dl 2020.03.24\n"
time="2020-04-15T13:35:09Z" level=info msg="using ffmpeg ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers\nbuilt with gcc 9.2.0 (Alpine 9.2.0)\nconfiguration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --disable-debug\nlibavutil      56. 31.100 / 56. 31.100\nlibavcodec     58. 54.100 / 58. 54.100\nlibavformat    58. 29.100 / 58. 29.100\nlibavdevice    58.  8.100 / 58.  8.100\nlibavfilter     7. 57.100 /  7. 57.100\nlibavresample   4.  0.  0 /  4.  0.  0\nlibswscale      5.  5.100 /  5.  5.100\nlibswresample   3.  5.100 /  3.  5.100\nlibpostproc    55.  5.100 / 55.  5.100\n"
time="2020-04-15T13:35:09Z" level=info msg="opening database \"db\""
time="2020-04-15T13:35:09Z" level=info msg="All 0 tables opened in 0s\n"
time="2020-04-15T13:35:09Z" level=fatal msg="failed to open database" error="failed to open database: Mmap value log file. Path=db/000000.vlog. Error=cannot allocate memory"

I'm on the Pi 2 Model B v1.1

I just programmed my first python app https://github.com/pblgomez/ptsooy Maybe it works for you too. You can download your own subscriptions and it make everything else like podsync. Try it please.

pblgomez avatar May 09 '20 21:05 pblgomez

You could do this with a multi stage Dockerfile:

FROM golang:alpine AS builder
LABEL stage=builder
WORKDIR /workspace
COPY . .
RUN go build -o /bin/podsync ./cmd/podsync

FROM alpine:3.10
WORKDIR /app/
RUN wget -O /usr/bin/youtube-dl https://github.com/ytdl-org/youtube-dl/releases/latest/download/youtube-dl && \
    chmod +x /usr/bin/youtube-dl && \
    apk --no-cache add ca-certificates python ffmpeg tzdata
COPY --from=builder /bin/podsync .
CMD ["/app/podsync"]

Actually, the second part is the current podsync Dockerfile. Except for the COPY, as I had to adjust it to copy the binary from the builder part. You can now do this: docker buildx build -t podsync-test --platform=linux/amd64,linux/arm64,linux/arm/v6,linux/386 .

But you need to have buildx activated. However, it currently fails because youtube-dl is currently offline due to DMCA. But if you remove the wget and the chmod line and add youtube-dl to the apk line, it works.

Further readings:

  • https://www.docker.com/blog/multi-arch-images/
  • https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/
  • https://www.docker.com/blog/multi-arch-build-what-about-travis/
  • https://medium.com/@artur.klauser/building-multi-architecture-docker-images-with-buildx-27d80f7e2408

However, as I really need the arm build, I'll use this in the meantime:

Dockerfile:

FROM golang:alpine AS builder
# PODSYNC_VERSION can be changed, by passing `--build-arg PODSYNC_VERSION=<new version>` during docker build
ARG PODSYNC_VERSION=v1
ENV PODSYNC_VERSION=${PODSYNC_VERSION}
LABEL stage=builder
WORKDIR /workspace
RUN wget -O - https://github.com/mxpv/podsync/archive/${PODSYNC_VERSION}.tar.gz | tar -xz --strip-components=1
RUN go build -o /bin/podsync ./cmd/podsync

FROM alpine:3.12
WORKDIR /app/
RUN apk --no-cache upgrade && apk --no-cache add ca-certificates ffmpeg tzdata youtube-dl
COPY --from=builder /bin/podsync .
CMD ["/app/podsync"]

Commands:

PCURVERSION=$(curl -s https://github.com/mxpv/podsync/releases/ | grep tree -m 1 | cut -d'"' -f2 | cut -d'/' -f5)
docker buildx build --push -t tdeutsch/podsync:latest -t tdeutsch/podsync:${PCURVERSION} -t tdeutsch/podsync:$(echo ${PCURVERSION} | cut -d'.' -f-2) --platform=linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/386 --build-arg PODSYNC_VERSION=${PCURVERSION} .

Result: Bildschirmfoto 2020-10-28 um 10 20 34

tuxpeople avatar Oct 28 '20 08:10 tuxpeople

Find my (above explained) stuff in a bit changed way here: https://github.com/tuxpeople/docker-podsync

This is what I use currently till we get the official ARM Image :-D

tuxpeople avatar Nov 03 '20 10:11 tuxpeople

@mxpv I have no idea about goreleaser but saw this here and thought about a pull request: https://carlosbecker.com/posts/multi-platform-docker-images-goreleaser-gh-actions/

However, this would end up in different tags for the different archs. And I'm not a fan of that. This here would "fix" that: https://namiops.medium.com/golang-multi-arch-docker-image-with-github-action-b59a62c8d2bd

But in this case you would have to move the image build from goreleaser into the github workflow. Would that be okay for you?

tuxpeople avatar Sep 30 '21 09:09 tuxpeople