Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker image for ARM builds #56

Open
mxpv opened this issue Nov 25, 2019 · 11 comments
Open

Add Docker image for ARM builds #56

mxpv opened this issue Nov 25, 2019 · 11 comments
Labels
A-docker Area: Docker container A-packaging Area: Deployment packages C-feature-request Category: A feature request P-high High priority

Comments

@mxpv
Copy link
Owner

mxpv commented Nov 25, 2019

ref #48

@pblgomez
Copy link

pblgomez commented Jan 1, 2020

waiting for a docker arm image

@pblgomez
Copy link

pblgomez commented Feb 1, 2020

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

@pinano
Copy link

pinano commented Feb 1, 2020

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!!! :)

@pblgomez
Copy link

pblgomez commented Feb 1, 2020

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

@mxpv
Copy link
Owner Author

mxpv commented Feb 2, 2020

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

@melgu
Copy link

melgu commented Apr 15, 2020

@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

@pblgomez
Copy link

pblgomez commented Apr 16, 2020

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. ;)

@mxpv mxpv added A-docker Area: Docker container C-feature-request Category: A feature request A-packaging Area: Deployment packages P-high High priority labels Apr 18, 2020
@pblgomez
Copy link

pblgomez commented May 9, 2020

@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.

@tuxpeople
Copy link
Contributor

tuxpeople commented Oct 28, 2020

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:

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
Copy link
Contributor

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
Copy link
Contributor

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docker Area: Docker container A-packaging Area: Deployment packages C-feature-request Category: A feature request P-high High priority
Projects
None yet
Development

No branches or pull requests

5 participants