diff --git a/dockerfiles/v1/focal260-amazonlinux b/dockerfiles/v1/focal260-amazonlinux index 16ff581d..c924d15e 100644 --- a/dockerfiles/v1/focal260-amazonlinux +++ b/dockerfiles/v1/focal260-amazonlinux @@ -1,4 +1,5 @@ FROM amazonlinux:2.0.20240620.0 AS amazonlinux +SHELL ["/bin/bash", "-c"] FROM ubuntu:20.04 AS bbb-playback ENV DEBIAN_FRONTEND=noninteractive @@ -47,46 +48,45 @@ ENV NGINX_HOSTNAME=localhost CMD [ "/etc/nginx/start", "-g", "daemon off;" ] FROM amazonlinux-base AS base -# Install Node.js (needed for yarn) +# Install basic packages RUN yum -y install git gcc-c++ make libyaml-devel libffi-devel glibc-devel readline-devel openssl-devel +# Install Node.js (needed for yarn) RUN curl -sL https://rpm.nodesource.com/setup_16.x | bash - RUN yum -y install nodejs -# Install Ruby & Rails +# Install other packages RUN curl -sL -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo RUN amazon-linux-extras enable postgresql14 \ - && yum -y install tar gzip yarn shared-mime-info libxslt zlib-devel sqlite-devel mariadb-devel libpq-devel -RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv && \ - echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc && \ - echo 'eval "$(rbenv init -)"' >> ~/.bashrc && \ - git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build && \ - ~/.rbenv/bin/rbenv install 3.3.6 && \ - ~/.rbenv/bin/rbenv global 3.3.6 && \ - ~/.rbenv/bin/rbenv rehash + && yum -y install tar gzip yarn shared-mime-info libxslt zlib-devel sqlite-devel mariadb-devel libpq-devel python3 python3-pip shadow-utils +# Install Ruby +RUN git clone https://github.com/rbenv/rbenv.git /root/.rbenv && \ + git clone https://github.com/rbenv/ruby-build.git /root/.rbenv/plugins/ruby-build && \ + /root/.rbenv/bin/rbenv install 3.3.6 && \ + /root/.rbenv/bin/rbenv global 3.3.6 && \ + /root/.rbenv/bin/rbenv rehash ENV PATH="/root/.rbenv/shims:/root/.rbenv/bin:$PATH" -RUN yum -y install python3 python3-pip shadow-utils RUN gem install bundler -v '~> 2.5' - +# Setup user scalelite RUN groupadd scalelite --gid 1000 && \ useradd -u 1000 -d /srv/scalelite -g scalelite scalelite RUN groupadd scalelite-spool --gid 2000 && \ usermod -a -G scalelite-spool scalelite +USER scalelite:scalelite WORKDIR /srv/scalelite +RUN echo 'export PATH="/root/.rbenv/bin:$PATH"' >> ~/.bashrc && \ + echo 'eval "$(/root/.rbenv/bin/rbenv init -)"' >> ~/.bashrc FROM base as builder -RUN rm -rf nginx -USER scalelite:scalelite COPY --chown=scalelite:scalelite Gemfile* ./ -RUN bundle --version -RUN bundle config build.nokogiri --use-system-libraries -RUN bundle config set --local deployment 'true' -RUN bundle config set --local without 'development:test' -RUN bundle install -j4 -RUN rm -rf vendor/bundle/ruby/*/cache -RUN find vendor/bundle/ruby/*/gems/ \( -name '*.c' -o -name '*.o' \) -delete +RUN source ~/.bashrc && bundle --version && \ + bundle config build.nokogiri --use-system-libraries && \ + bundle config set --local deployment 'true' && \ + bundle config set --local without 'development:test' && \ + bundle install -j4 && \ + rm -rf vendor/bundle/ruby/*/cache && \ + find vendor/bundle/ruby/*/gems/ \( -name '*.c' -o -name '*.o' \) -delete COPY --chown=scalelite:scalelite . ./ FROM base AS application -USER scalelite:scalelite ENV RAILS_ENV=production RAILS_LOG_TO_STDOUT=true COPY --from=builder --chown=scalelite:scalelite /srv/scalelite ./