Skip to content

Commit

Permalink
Set RUBOCOP_CACHE_ROOT + install NodeJS the Rails Way
Browse files Browse the repository at this point in the history
  • Loading branch information
ssaunier committed May 30, 2024
1 parent 2428538 commit 20b7e4b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ RUN apt-get update && apt-get install -y locales \
&& rm -rf /var/lib/apt/lists/*
ENV LANG en_US.utf8

# Node
ARG NODE_VERSION=14.21.3
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && rm -rf /tmp/node-build-master

# Binary dependencies for SQLite
RUN apt-get update && apt-get install -y sqlite3 libsqlite3-dev curl gnupg \
&& rm -rf /var/lib/apt/lists/*
ENV FULLSTACK_FOLDER /workspace
ENV RUBOCOP_CACHE_ROOT /workspace
WORKDIR $FULLSTACK_FOLDER
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get -y install nodejs

COPY Gemfile $FULLSTACK_FOLDER/Gemfile
RUN ["bundle", "install"]

# Run and own only the runtime files as a non-root user for security
RUN useradd ruby --create-home --shell /bin/bash && chown -R ruby:ruby $FULLSTACK_FOLDER
USER ruby:ruby

0 comments on commit 20b7e4b

Please sign in to comment.