FROM amazonlinux:2 MAINTAINER SciNote ENV LANG C.UTF-8 ENV RUBY_VERSION 3.2.4 ENV RUBY_DOWNLOAD_URL https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.4.tar.xz ENV RUBY_DOWNLOAD_SHA256 e7f1653d653232ec433472489a91afbc7433c9f760cc822defe7437c9d95791b RUN echo 'exclude=openssl11*' >> /etc/yum.conf RUN amazon-linux-extras enable \ postgresql14 \ libreoffice \ java-openjdk11 \ epel RUN yum clean metadata && \ yum update -q -y && \ yum install -y --disableplugin=priorities \ ruby \ git \ autoconf \ gcc \ gcc-c++ \ rust \ tar \ gtk3 \ xz \ which \ procps \ cargo \ bison \ gdbm-devel \ libyaml-devel \ readline-devel \ libffi-devel \ wget \ dracut-fips \ dracut-fips-aesni \ openssl \ openssl-devel \ postgresql \ libpq-devel \ java-11-openjdk \ poppler-utils \ librsvg2 \ graphviz \ epel-release RUN yum install -y GraphicsMagick \ chromium \ libreoffice-writer \ libreoffice-calc \ libreoffice-impress \ libreoffice-filters # Ruby compiling code is based on https://github.com/docker-library/ruby/blob/master/3.2/bookworm/Dockerfile ############################################################################################################ # skip installing gem documentation RUN set -eux; \ mkdir -p /usr/local/etc; \ { \ echo 'install: --no-document'; \ echo 'update: --no-document'; \ } >> /usr/local/etc/gemrc RUN set -eux; \ wget -O ruby.tar.xz "$RUBY_DOWNLOAD_URL"; \ echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum --check --strict; \ mkdir -p /usr/src/ruby; \ tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1; \ rm ruby.tar.xz; \ cd /usr/src/ruby; \ autoconf; \ ./configure --disable-install-doc --enable-shared --enable-yjit; \ make -j "$(nproc)"; \ make install; \ cd /; \ rm -r /usr/src/ruby; \ yum remove -y ruby*; \ # verify we have no "ruby" packages installed if yum list installed | grep -i ruby; then exit 1; fi; \ [ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \ # rough smoke test ruby --version; \ gem --version; \ bundle --version ############################################################################################################ ENV GEM_HOME /usr/local/bundle ENV BUNDLE_SILENCE_ROOT_WARNING=1 ENV BUNDLE_APP_CONFIG="$GEM_HOME" RUN mkdir -p "$GEM_HOME" && chmod 1777 "$GEM_HOME" ENV PS1 '\u@\h:\w\$ ' ENV BUNDLE_PATH /usr/local/bundle/ # create app directory ENV APP_HOME /usr/src/app RUN mkdir $APP_HOME RUN adduser -m scinote RUN chown scinote:scinote $APP_HOME USER scinote WORKDIR /home/scinote RUN mkdir ~/.cache RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash RUN source ~/.bashrc && \ nvm install lts/gallium && \ npm install yarn puppeteer@npm:puppeteer-core ENV PATH $GEM_HOME/bin:~/node_modules/.bin:$APP_HOME/bin:$PATH WORKDIR $APP_HOME CMD source ~/.bashrc && rails s -b 0.0.0.0