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

Adding a Dockerfile and updated README with instructions to run using docker #937

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jamesmortensen
Copy link

I experienced the issue described here #928 (comment) when using the docker image. It seems the version of Showoff in the docker image is one version behind, from approximately 2 years ago, and it has a bug where images won't render in the presentations.

I couldn't find the Dockerfile, so I rebuilt it and included it here with instructions to build the image locally. It would be awesome if we can update the Docker image on Docker Hub, but in the meantime, folks can rebuild the image locally if they want to run with docker.

I checked the examples. From what I can tell, everything works. I'm new to Showoff, so I wasn't sure what I was supposed to see with the "executable code" slides. Hope this helps!

@CLAassistant
Copy link

CLAassistant commented Apr 21, 2023

CLA assistant check
All committers have signed the CLA.

@jamesmortensen
Copy link
Author

I just now noticed the Dockerfile in https://github.com/puppetlabs/showoff/blob/main/build/Dockerfile. Please let me know if I need to amend the commits to remove it. I think the README instructions on how to build it are helpful, but may need to be updated to point to the build folder.

@jamesmortensen
Copy link
Author

I tried building with the already-committed Dockerfile in the build directory, and I am getting build errors. Since the Dockerfile I rebuilt seems to produce a functional showoff binary, I'm wondering if we want to replace build/Dockerfile with the one that I put in the root of the repository.

Here are the build errors from building from the build folder:

 docker build -t local/showoff .
[+] Building 54.3s (7/7) FINISHED                                                                                                               
 => [internal] load build definition from Dockerfile                                                                                       0.0s
 => => transferring dockerfile: 601B                                                                                                       0.0s
 => [internal] load .dockerignore                                                                                                          0.0s
 => => transferring context: 2B                                                                                                            0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                           7.4s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                              0.0s
 => [1/3] FROM docker.io/library/alpine@sha256:124c7d2707904eea7431fffe91522a01e5a861a624ee31d03372cc1d138a3126                            0.0s
 => => resolve docker.io/library/alpine@sha256:124c7d2707904eea7431fffe91522a01e5a861a624ee31d03372cc1d138a3126                            0.0s
 => => sha256:124c7d2707904eea7431fffe91522a01e5a861a624ee31d03372cc1d138a3126 1.64kB / 1.64kB                                             0.0s
 => => sha256:b5a5b7ce4eabc8414bf367761a28f4e8b16952ce5de537c15ed917b71b245f11 528B / 528B                                                 0.0s
 => => sha256:51e60588ff2cd9f45792b23de89bfface0a7fbd711d17c5f5ce900a4f6b16260 1.49kB / 1.49kB                                             0.0s
 => [2/3] WORKDIR /var/cache/showoff                                                                                                       0.0s
 => ERROR [3/3] RUN apk add --no-cache ruby ruby-dev zlib-dev build-base git cmake busybox         && gem install etc commonmarker showo  46.8s
------                                                                                                                                          
 > [3/3] RUN apk add --no-cache ruby ruby-dev zlib-dev build-base git cmake busybox         && gem install etc commonmarker showoff --no-document                      && apk del --purge  binutils isl libgomp libatomic mpc1 gcc make musl-dev libc-dev fortify-headers g++ build-base libacl libbz2 xz-libs libarchive cmake              && rm -rf `gem environment gemdir`/gems/commonmarker-*/test                && rm -rf `gem environment gemdir`/cache:                                                                                                                               
#0 0.264 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/aarch64/APKINDEX.tar.gz                                                         
#0 1.960 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/aarch64/APKINDEX.tar.gz
#0 2.414 (1/51) Installing libgcc (12.2.1_git20220924-r4)
#0 2.507 (2/51) Installing libstdc++ (12.2.1_git20220924-r4)
#0 2.663 (3/51) Installing binutils (2.39-r2)
#0 3.074 (4/51) Installing libmagic (5.43-r0)
#0 3.208 (5/51) Installing file (5.43-r0)
#0 3.267 (6/51) Installing libgomp (12.2.1_git20220924-r4)
#0 3.356 (7/51) Installing libatomic (12.2.1_git20220924-r4)
#0 3.421 (8/51) Installing gmp (6.2.1-r2)
#0 3.537 (9/51) Installing isl25 (0.25-r1)
#0 3.748 (10/51) Installing mpfr4 (4.1.0-r0)
#0 3.838 (11/51) Installing mpc1 (1.2.1-r1)
#0 3.935 (12/51) Installing gcc (12.2.1_git20220924-r4)
#0 8.986 (13/51) Installing libstdc++-dev (12.2.1_git20220924-r4)
#0 10.58 (14/51) Installing musl-dev (1.2.3-r4)
#0 11.01 (15/51) Installing libc-dev (0.7.2-r3)
#0 11.07 (16/51) Installing g++ (12.2.1_git20220924-r4)
#0 12.43 (17/51) Installing make (4.3-r1)
#0 12.51 (18/51) Installing fortify-headers (1.1-r1)
#0 12.57 (19/51) Installing patch (2.7.6-r9)
#0 12.64 (20/51) Installing build-base (0.5-r3)
#0 12.70 (21/51) Installing libacl (2.3.1-r1)
#0 12.76 (22/51) Installing libbz2 (1.0.8-r4)
#0 12.83 (23/51) Installing libexpat (2.5.0-r0)
#0 12.90 (24/51) Installing lz4-libs (1.9.4-r1)
#0 12.97 (25/51) Installing xz-libs (5.2.9-r0)
#0 13.05 (26/51) Installing zstd-libs (1.5.5-r0)
#0 13.13 (27/51) Installing libarchive (3.6.1-r2)
#0 13.25 (28/51) Installing ca-certificates (20220614-r4)
#0 13.42 (29/51) Installing brotli-libs (1.0.9-r9)
#0 13.60 (30/51) Installing nghttp2-libs (1.51.0-r0)
#0 13.67 (31/51) Installing libcurl (8.0.1-r0)
#0 13.80 (32/51) Installing ncurses-terminfo-base (6.3_p20221119-r0)
#0 13.87 (33/51) Installing ncurses-libs (6.3_p20221119-r0)
#0 14.03 (34/51) Installing rhash-libs (1.4.3-r1)
#0 14.30 (35/51) Installing libuv (1.44.2-r0)
#0 14.39 (36/51) Installing cmake (3.24.4-r0)
#0 17.07 (37/51) Installing pcre2 (10.42-r0)
#0 17.16 (38/51) Installing git (2.38.4-r1)
#0 17.96 (39/51) Installing libffi (3.4.4-r0)
#0 18.02 (40/51) Installing readline (8.2.0-r0)
#0 18.10 (41/51) Installing yaml (0.2.5-r0)
#0 18.31 (42/51) Installing ruby-libs (3.1.4-r0)
#0 19.13 (43/51) Installing libucontext (1.2-r0)
#0 19.18 (44/51) Installing ruby (3.1.4-r0)
#0 19.24 (45/51) Installing ruby-rdoc (3.1.4-r0)
#0 19.38 (46/51) Installing libgmpxx (6.2.1-r2)
#0 19.44 (47/51) Installing pkgconf (1.9.4-r0)
#0 19.52 (48/51) Installing gmp-dev (6.2.1-r2)
#0 19.62 (49/51) Installing libucontext-dev (1.2-r0)
#0 19.68 (50/51) Installing ruby-dev (3.1.4-r0)
#0 19.82 (51/51) Installing zlib-dev (1.2.13-r0)
#0 19.89 Executing busybox-1.35.0-r29.trigger
#0 19.90 Executing ca-certificates-20220614-r4.trigger
#0 19.94 OK: 328 MiB in 66 packages
#0 21.74 Building native extensions. This could take a while...
#0 24.11 Successfully installed etc-1.4.2
#0 24.11 Building native extensions. This could take a while...
#0 38.00 Successfully installed commonmarker-0.23.9
#0 38.00 Successfully installed tilt-2.1.0
#0 38.00 Successfully installed rack-2.2.6.4
#0 38.00 Building native extensions. This could take a while...
#0 44.15 Successfully installed eventmachine-1.2.7
#0 44.15 Successfully installed daemons-1.4.1
#0 44.15 Building native extensions. This could take a while...
#0 44.69 Successfully installed thin-1.8.2
#0 44.69 Successfully installed public_suffix-5.0.1
#0 44.69 Successfully installed addressable-2.8.4
#0 44.69 Successfully installed em-websocket-0.3.8
#0 44.69 Successfully installed sinatra-websocket-0.3.1
#0 44.69 Successfully installed rack-protection-2.2.4
#0 44.69 Successfully installed mustermann-2.0.2
#0 44.69 Successfully installed sinatra-2.2.4
#0 44.69 Building native extensions. This could take a while...
#0 46.63 Successfully installed redcarpet-3.6.0
#0 46.63 Successfully installed rack-contrib-2.3.0
#0 46.63 Successfully installed parslet-2.0.0
#0 46.63 Successfully installed nokogiri-1.14.3-aarch64-linux
#0 46.63 Successfully installed iso-639-0.3.6
#0 46.63 Successfully installed concurrent-ruby-1.2.2
#0 46.63 Successfully installed i18n-1.12.0
#0 46.63 Successfully installed htmlentities-4.3.4
#0 46.63 Successfully installed gli-2.21.0
#0 46.63 Successfully installed ruby-dbus-0.14.1
#0 46.63 Successfully installed fidget-0.0.6
#0 46.63 Successfully installed showoff-0.20.4
#0 46.63 26 gems installed
#0 46.64 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/main: No such file or directory
#0 46.64 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/community: No such file or directory
#0 46.64 ERROR: No such package: isl
------
ERROR: failed to solve: executor failed running [/bin/sh -c apk add --no-cache ruby ruby-dev zlib-dev build-base git cmake busybox         && gem install etc commonmarker showoff --no-document                      && apk del --purge  binutils isl libgomp libatomic mpc1 gcc make musl-dev libc-dev fortify-headers g++ build-base libacl libbz2 xz-libs libarchive cmake              && rm -rf `gem environment gemdir`/gems/commonmarker-*/test                && rm -rf `gem environment gemdir`/cache]: exit code: 1

README.md Outdated

Or build the image yourself:

docker build -t Dockerfile local/showoff .
Copy link

@lvoss lvoss Apr 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I just stumbled upon this project and thankfully over your Merge Request.
I did try out your Dockerfile. It works like a charm. The "old" Dockerfile doesn't work for me, I run into the exact same error as you mentioned above.
There is an error though in this line, the flag "-f" is missing. The following would be correct:

docker build -f Dockerfile -t local/showoff .

I would also suggest overwriting the Dockerfile under build/Dockerfile as you mentioned.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lvoss Glad you found this helpful.

As for the -f flag, I may be missing something, but I believe the default value of -f is "Dockerfile" and that -f is only needed if using a name other than "Dockerfile". I'd be interested to see the error you're getting if you're not able to build without the -f flag and the file is named "Dockerfile". Are you using the latest version of the docker CLI?

And as for where to put this Dockerfile, I'm waiting to hear what the maintainer wants to do. I agree replacing the build/Dockerfile may be best, since it doesn't appear to be working properly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, now I see what the problem is. I have the -t in the wrong place. I'll fix it. Thanks for catching it. Apparently, I was missing something.

@lvoss
Copy link

lvoss commented Apr 30, 2023

Another sidenote, which may be relevant for the Readme: I just noticed that you should mount the /example/ folder instead of the full project folder in order for the images to load.
So either running the docker run command from within the /example/ folder or changing the command.

docker run --rm -it -p 9090:9090 -v $(pwd)/example:/var/cache/showoff local/showoff

Edit: nevermind, running the container in the example-folder ruins the print-functionality.
Running it in the root folder makes it so that no images can be loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants