FROM ruby:3.3 LABEL maintainer='david@hohl.cloud' ARG NAME=app ARG UID=1000 ARG GID=1000 ARG APP_PORT=3000 ARG INSTALL_DIR=/${NAME} WORKDIR ${INSTALL_DIR} ENV GEM_HOME=${INSTALL_DIR}/.bundle ENV \ LANG=C.UTF-8 \ INSTALL_DIR=${INSTALL_DIR} \ RAILS_ENV=development \ TZ=Europe/Zurich \ PATH=${INSTALL_DIR}/bin:$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH \ EDITOR=vim RUN \ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ echo $TZ > /etc/timezone && \ addgroup --gid ${GID} ${NAME} && \ adduser \ --gecos GECOS \ --home /home/${NAME} \ --uid ${UID} \ --gid ${GID} \ --disabled-password \ --disabled-login \ --shell /bin/bash \ ${NAME} && \ apt-get update && \ apt-get install -yqq --no-install-recommends \ gnupg2 \ curl && \ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ apt-get update -yqq && \ apt-get install -yqq --no-install-recommends \ sqlite3 nodejs npm sassc yarn libvips && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ truncate -s 0 /var/log/*log && \ gem update --system && \ bundle config set app_config ${GEM_HOME} USER ${NAME} EXPOSE ${APP_PORT} ENTRYPOINT [ "bin/entrypoint" ] ENV SERVER_PORT=$APP_PORT # Using variables in command list is not possible: # https://stackoverflow.com/questions/40454470/how-can-i-use-a-variable-inside-a-dockerfile-cmd CMD rails server --binding 0.0.0.0 --no-daemon --port $SERVER_PORT