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

6045-docker-hub-official-image #6047

Merged
merged 10 commits into from
Nov 23, 2023

Conversation

khalyomede
Copy link
Contributor

@khalyomede khalyomede commented Nov 21, 2023

Issue

Added

  • Docker images for the following tags
    • nightly-ubuntu-2004
    • nightly-ubuntu-2204
    • nightly-ubuntu-latest
    • nightly-debian-buster
    • nightly-debian-bookworm
    • nightly-debian-latest
  • Github Action to assert these images runs tests correctly

Fixed

None

Breaking

None

## Notes

The "tags" follow this naming convention:

[roc-version]-[os-name]-[os-major-version]

Proposed policy: we maintain 2 latest LTS versions of an OS + the latest tag targets the last version for each OSes.

@khalyomede
Copy link
Contributor Author

khalyomede commented Nov 21, 2023

The current code misses the Alpine image, waiting some approval to add it once the Ubuntu image is satisfying (maybe it should be marked as draft, but I am afraid drafts do not run Github Actions).

@aminnairi care to give a hand to add the 1000:1000 user on this image?

@@ -0,0 +1,16 @@
FROM ubuntu:22.04
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @khalyomede I'm one of the people @Anton-4 mentioned in the PR who talked about Docker on zulip. For my experiments with a dedicated Roc docker image I tried Debian bullseye - it worked. I have two questions:

  • if Ubuntu is built on Debian, would it make sense to go directly for Debian? Or maybe even Alpine to keep things small.
  • would it make sense to use @latest tag? the benefit of this approach is that we'd get quick feedback. The tests would fail indicating that the new OS changes are incompatible with Roc

Keep in mind I'm a Sunday docker user, I might be wrong so post this feedback as questions.

Choose a reason for hiding this comment

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

Hi Jakub,

As per my discussion in the related issue and my tests, using Roc on Alpine is not trivial and would probably require some research on what dynamic libraries are needed in order for Roc to work properly on Alpine.

And to address your second point, using the latest tag would be problematic for reproducability since it is the sole point of Docker and most IAC solutions out there.

If you need to tests things out, you can use a combination of dynamic image name and a GitHub Action Matrix in order to test against multiple versions of Debian if you'd like.

ARG DEBIAN_VERSION=12.0.0 #hypothetic Debian version, must refer to the available tags

FROM debian:$DEBIAN_VERSION

Copy link
Contributor Author

@khalyomede khalyomede Nov 21, 2023

Choose a reason for hiding this comment

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

if Ubuntu is built on Debian, would it make sense to go directly for Debian? Or maybe even Alpine to keep things small.

I do not have a strong opinion on one or the other, what you say makes sense, maybe we can support Ubuntu for the first time, if we have some request we may create another tag without any issues (maintaining one or two will not make a big difference since the OSes are quite close to each other).

would it make sense to use @latest tag? the benefit of this approach is that we'd get quick feedback. The tests would fail indicating that the new OS changes are incompatible with Roc

We may create another tag and maintain both ubuntu-2204-nightly and ubuntu-latest-nightly for this purpose, I do not see any issues against this I'll work on it.

Thanks for the feedback @jakub-c

@khalyomede
Copy link
Contributor Author

khalyomede commented Nov 21, 2023

FYI my attempt at running Roc on Alpine failed. Below is a complete breakdown:

I used the following Dockerfile:

FROM alpine:3

RUN apk update
RUN apk add --no-cache \
    wget \
    musl-dev \
    binutils \
    clang \
    gcompat
RUN wget -q -O roc.tar.gz https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-old_linux_x86_64-latest.tar.gz
RUN mkdir /usr/bin/roc
# --strip-components=1 not needed once https://github.com/roc-lang/roc/issues/4118 is solved.
RUN tar -xvz -f roc.tar.gz --directory /usr/bin/roc --strip-components=1
RUN addgroup -g 1000 -S roc
RUN adduser -g "" -h /home/roc -s /bin/sh -SDu 1000 roc

And this dockerfile:

version: "3"
services:
  roc:
    build: .
    entrypoint: roc
    working_dir: /home/roc/app
    user: roc
    volumes:
      - ../../:/home/roc/app

I stumbled upon the first issue: sh roc: not found. Then I started to execute sh and log into the container to check what is happening by updating the "docker-compose.yml" file:

version: "3"
services:
  roc:
    build: .
    tty: true
    working_dir: /home/roc/app
    user: roc
    volumes:
      - ../../:/home/roc/app

And then docker-compose up -d && docker-compose exec roc sh. Once in the container, I have moved on the "/usr/bin/roc" folder, and when I tried to execute ./roc, same error: sh ./roc: not found. With the help of @aminnairi, we noticed Roc is compiled with some dynamic libraries that may not be supported on Alpine:

$ ldd roc 
        /lib64/ld-linux-x86-64.so.2 (0x7f38a21ea000)
        librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f38a21ea000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f38a21ea000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f38a21ea000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f38a21ea000)
        libz.so.1 => /lib/libz.so.1 (0x7f389ddbf000)
Error loading shared library libtinfo.so.6: No such file or directory (needed by roc)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f389db71000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f389db53000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f38a21ea000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by roc)
Error relocating roc: mallinfo: symbol not found
Error relocating roc: del_curterm: symbol not found
Error relocating roc: setupterm: symbol not found
Error relocating roc: __memcpy_chk: symbol not found
Error relocating roc: set_curterm: symbol not found
Error relocating roc: __register_atfork: symbol not found
Error relocating roc: tigetnum: symbol not found
Error relocating roc: __snprintf_chk: symbol not found
Error relocating roc: gnu_get_libc_version: symbol not found
Error relocating roc: __res_init: symbol not found

If it is okay for you guys, I think in this issue we will only support Ubuntu (the question still remains if you want to also support Debian, or only Debian). I have opened the issue ... to discuss furthermore.

@jakub-c
Copy link
Contributor

jakub-c commented Nov 22, 2023

FYI my attempt at running Roc on Alpine failed

@khalyomede if nobody's explicitly asking for Alpine, than Ubuntu / Debian is probably the way to go. It always possible to shave few MBs later on, if there's a need for a smaller image.

@Anton-4 Anton-4 self-assigned this Nov 22, 2023
@khalyomede
Copy link
Contributor Author

FYI the Docker image fails to run Roc properly on Debian 10 (Buster) because glibc seems to not be integrated, and after attempts to install libc6-dev it still does not work properly.

We will just support Debian 12 (Bookworm), and since Debian 10 (Buster) was the latest LTS, we will not have other Debian versions to support other than 12 (when 13 comes out, if 12 is LTS, we will keep supporting 12).

The issue have been encountered with the following Dockerfile:

FROM debian:buster

RUN apt-get update --fix-missing
RUN apt-get upgrade --yes
RUN apt-get install --yes \
    wget \
    libc-dev \
    binutils \
    build-essential \
    clang
RUN wget -q -O roc.tar.gz https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
RUN mkdir /usr/lib/roc
# --strip-components=1 not needed once https://github.com/roc-lang/roc/issues/4118 is solved.
RUN tar -xvz -f roc.tar.gz --directory /usr/lib/roc --strip-components=1

ENV PATH="$PATH:/usr/lib/roc"
$ docker-compose -f docker/debian-buster-nightly/docker-compose.yml run roc version
roc: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by roc)
roc: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by roc)
roc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.29' not found (required by roc)

@khalyomede
Copy link
Contributor Author

I have changed the Docker image naming convention from:

[os-name]-[os-version]-[roc-version]

To

[roc-version]-[os-name]-[os-version]

Which makes more sense since the developer will mostly care about the roc version first when searching the tag on Docker Hub, and also to keep consistancy with what is already done on other language images on Docker Hub (like Node or PHP).

@Anton-4
Copy link
Collaborator

Anton-4 commented Nov 22, 2023

the Docker image fails to run Roc properly on Debian 10 (Buster)

I think using an old_linux release should fix this: https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-old_linux_x86_64-latest.tar.gz

@khalyomede
Copy link
Contributor Author

the Docker image fails to run Roc properly on Debian 10 (Buster)

I think using an old_linux release should fix this: https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-old_linux_x86_64-latest.tar.gz

I also tried and had no luck trying with the old linux release as well unfortunately

@Anton-4
Copy link
Collaborator

Anton-4 commented Nov 22, 2023

Hmm that's strange because it's built on debian buster :p

@khalyomede
Copy link
Contributor Author

Hmm that's strange because it's built on debian buster :p

My bad, I think I just shuffled my files around, it works indeed 🎊 will push the tag now thank you!

@Anton-4
Copy link
Collaborator

Anton-4 commented Nov 22, 2023

Thank you very much @khalyomede!
I've removed the C platform stuff, most users will be using prebuilt platforms like basic-cli.

@Anton-4
Copy link
Collaborator

Anton-4 commented Nov 22, 2023

I'll try to set it up on dockerhub this week

Copy link
Contributor Author

@khalyomede khalyomede left a comment

Choose a reason for hiding this comment

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

Great thank you for this addition!

@Anton-4
Copy link
Collaborator

Anton-4 commented Nov 22, 2023

Can you merge this @rtfeldman?

@rtfeldman rtfeldman merged commit 3d8884a into roc-lang:main Nov 23, 2023
14 checks passed
@Anton-4
Copy link
Collaborator

Anton-4 commented Nov 25, 2023

The images are now available on docker hub: https://hub.docker.com/repositories/roclang

@aminnairi
Copy link

The images are now available on docker hub: https://hub.docker.com/repositories/roclang

Looks like they are in a private repository or some kind of unknown issue with the repository link because I'm getting the Docker Login screen when trying to access it while other images are still available.

@Anton-4
Copy link
Collaborator

Anton-4 commented Nov 27, 2023

The repository is public, only official docker repositories seem to be viewable without login. The process to make our repo official, is unfortunately quite involved.

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.

Docker Hub official image
5 participants