sightreading.training icon indicating copy to clipboard operation
sightreading.training copied to clipboard

Looks like Dockerfile is broken

Open Alerion opened this issue 6 years ago • 7 comments

Tried to fix myself but is not familiar with ArchLinux.

At first it was: error: sassc: signature from "Jerome Leclanche <[email protected]>" is unknown trust. I added RUN pacman-key --refresh-keys.

Then libnsl: /usr/include/rpcsvc/nis.h exists in filesystem. Added installing glibc.

And now it fails when I try to run container with node: error while loading shared libraries: libicui18n.so.63: cannot open shared object file: No such file or directory

Alerion avatar Jan 31 '19 19:01 Alerion

Hello, I've been wanting to investigate this project, and the Dockerfile seems to have broken 4 months ago, 2 dependencies up so to speak, and out of reach of @leafo it seems.

So you may look at my attempt to rebuild the project with this ubuntu based Dockerfile (I wanted to understand the tech stack)

It's a work in progress, there's still a few missing dependencies, and I'm kinda hacking it.

FROM ubuntu:18.04

RUN  DEBIAN_FRONTEND=noninteractive apt-get update \
  && echo "\033[1;33m=== Installing sassc dependencies ===\033[0;m" \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y \
                        build-essential \
                        git \
                        curl \
  && echo "\033[1;33m=== Installing openresty dependencies ===\033[0;m" \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y \
                        libpcre3 libpcre3-dev libssl-dev zlib1g-dev libgeoip-dev \
  && echo "\033[1;33m=== Installing app dependencies ===\033[0;m" \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y \
                        postgresql \
                        luarocks \
                        npm \
  && rm -rf /var/lib/apt/lists/*


# Compile sassc binary, no repos available
RUN curl -L https://github.com/sass/sassc/archive/3.5.0.tar.gz -o /tmp/sassc.tar.gz \
  && mkdir /tmp/sassc \
  && tar xvf /tmp/sassc.tar.gz --directory /tmp/sassc \
  && cd /tmp/sassc/ && mv sassc* sassc \
  && . ./sassc/script/bootstrap \
  && make -C sassc -j4 \
  && mv ./sassc/bin/sassc /usr/local/bin/ \
  && rm -r /tmp/sassc*

# setup openresty
# 1.13.6.1 does not compile due to libssl not being compatible
RUN curl -O https://openresty.org/download/openresty-1.13.6.2.tar.gz && \
  tar xvfz openresty-1.13.6.2.tar.gz && \
  (cd openresty-1.13.6.2 && ./configure --with-pcre-jit --with-http_geoip_module --with-cc-opt="-I/usr/include/openssl-1.0" --with-ld-opt="-L/usr/lib/openssl-1.0" && make && make install) && \
  rm -rf openresty-1.13.6.2 && rm openresty-1.13.6.2.tar.gz

# Ubuntu/initdb requirement
RUN locale-gen en_US.UTF-8 \
  && mkdir -p /var/lib/postgres/data \
  && chown -R postgres:postgres /var/lib/postgres

# setup postgresql
RUN su postgres -c "/usr/lib/postgresql/10/bin/initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'" \
  &&  chown postgres:postgres /run/postgresql

# hacky, ci.sh requirement
RUN ln -s /usr/bin/luarocks -T /usr/local/bin/luarocks-5.1

WORKDIR /site/sightreading.training
ADD . .
ENTRYPOINT ./ci.sh

benjamin-thomas avatar Jan 31 '19 20:01 benjamin-thomas

This in the Dockerfile got me some of the way:

-RUN pacman -Sy npm sassc --noconfirm &&
+RUN pacman-key --refresh-keys +RUN pacman-key --populate archlinux +RUN pacman -Syu --force npm sassc --noconfirm &&
yes | pacman -Scc

+RUN pacman -U --force https://archive.archlinux.org/packages/l/luarocks5.1/luarocks5.1-3.0.4-1-any.pkg.tar.xz --noconfirm +RUN pacman -U --force https://archive.archlinux.org/packages/p/postgresql/postgresql-9.6.5-1-x86_64.pkg.tar.xz --noconfirm

Plus removing this from ci.sh: -eval $(luarocks-4.1 path)

It seems like the Dockerfile has nothing to do with actually building this, but instead running testing (which has a few failures for me). I'm assuming to compile this requires running a tup command on Archlinux.

justinbass avatar Mar 01 '19 06:03 justinbass

@justinbass, good to know.

For info, the Debian based image I was playing with is kind of a no go.

I don't remember the details, but it seemed over complicated after a while: there are some hard coded bin paths here and there, PostgreSQL handling (cluster start) in Debian is too different, etc.

Having the db and the app bundled together seems to indicate the Dockerfile is indeed only useful for testing/developing.

benjamin-thomas avatar Mar 01 '19 07:03 benjamin-thomas

Yes, I tried your configuration on Ubuntu 18 with no success (in Docker, and by manually running the commands). The root cause of the issue is the fact that update needs to run, but the newer Archlinux images do not have the required old luarocks/postgresql version supported in this package. I'd submit a PR but the author might have different ideas on how to support this, so we can leave the ticket open for now. Also as mentioned the unit tests are broken even after my fix is implemented.

justinbass avatar Mar 01 '19 23:03 justinbass

the docker image is too out of date, so when trying to install those two missing packages there's version mismatch between the libs on the system. There are a few solutions:

  • update the whole image to latest arch linux. There are some complications here, Arch has since upgraded to luarocks 3, so a few tweaks need to be made to luarocks commands
  • use the current image, but use a tool to install older versions of the missing packages (and then seal this into a separate docker image so it's good without having to install any packages

I haven't had time to work on this project lately, but when I get some time I'll investigate the docker setup

leafo avatar Mar 02 '19 03:03 leafo

I've updated the base image and the dockerfile/ci script for this project. There are some broken tests that I'm still investigating

leafo avatar Mar 09 '19 00:03 leafo

Right now the quickest way to launch the Dockerfile is to comment out make test_db in ci.sh, then rebuild and run the docker image, right? I wanted to contribute on a small issue but I couldn't start the image.

Here's my docker run sightreading log https://gist.github.com/3nuc/5a63cc0b0ecfeaeb8b57064e176a1d8e on commit a012004. This is with an unmodified ci.sh

sethidden avatar Nov 02 '19 10:11 sethidden