diff --git a/Dockerfile b/Dockerfile index f4e3731..750967f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,34 @@ -# Do not update to Ruby 3 until Gemfile dependencies are fixed FROM docker.io/ruby:2.7.8-bullseye ARG BUNDLE_RUBYGEMS__PKG__GITHUB__COM - -# These are needed to support building native extensions during -# bundle install step -RUN apk --update add --virtual build_deps build-base git - -RUN addgroup -g 1000 -S appgroup \ - && adduser -u 1000 --system appuser \ - && adduser appuser appgroup \ - && gem install bundler \ - && bundle config +ENV CONTAINER_USER="nonroot" \ + CONTAINER_UID="10000" \ + CONTAINER_GROUP="nonroot" \ + CONTAINER_GID="10000" \ + CONTAINER_HOME="/app" \ + DEBIAN_FRONTEND="noninteractive" \ + NODE_MAJOR="18" + + +RUN apt-get update && apt-get install -y build-essential git + +RUN groupadd \ + --gid ${CONTAINER_GID} \ + --system \ + ${CONTAINER_GROUP} \ + && useradd \ + --uid ${CONTAINER_UID} \ + --gid ${CONTAINER_GROUP} \ + ${CONTAINER_USER} \ + && mkdir --parents ${CONTAINER_HOME} \ + && chown --recursive ${CONTAINER_USER}:${CONTAINER_GROUP} ${CONTAINER_HOME} # Required at runtime by middleman -RUN apk add --no-cache nodejs +# RUN apk add --no-cache nodejs + +RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list -WORKDIR /app +WORKDIR ${CONTAINER_HOME} COPY Gemfile Gemfile.lock ./