Skip to content

Instantly share code, notes, and snippets.

@fernandollisboa
Last active May 22, 2024 20:40
Show Gist options
  • Save fernandollisboa/99ad8f93195ac87c5ca828adc2304768 to your computer and use it in GitHub Desktop.
Save fernandollisboa/99ad8f93195ac87c5ca828adc2304768 to your computer and use it in GitHub Desktop.
# syntax=docker/dockerfile:1
FROM ruby:3.3.0
# Install nodejs
ENV NODE_VERSION 18.19.0
RUN ARCH=$(uname -m) \
&& if [ "$ARCH" = "aarch64" ]; then \
NODE_PACKAGE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-arm64.tar.xz"; \
else \
NODE_PACKAGE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz"; \
fi \
&& curl -sSL "$NODE_PACKAGE_URL" | tar xfJ - -C /usr/local --strip-components=1
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev wkhtmltopdf
# Add user and group for app
ENV ROOT_PATH /var/app
ENV USER_ID 1000
ENV GROUP_ID 1000
RUN groupadd --gid ${GROUP_ID} app \
&& useradd --system --create-home --no-log-init --uid ${USER_ID} --gid ${GROUP_ID} --groups sudo app \
&& mkdir ${ROOT_PATH} && chown -R app:app ${ROOT_PATH}
# Install chrome
ENV CHROME_VERSION 125.0.6422.76
RUN wget http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb \
&& dpkg -i google-chrome-stable_${CHROME_VERSION}-1_amd64.deb || true \
&& apt-get -f install -y \
&& rm -v google-chrome-stable_${CHROME_VERSION}-1_amd64.deb
WORKDIR /tmp
ADD ./Gemfile Gemfile
ADD ./Gemfile.lock Gemfile.lock
RUN bundle install --jobs 8
RUN gem install foreman
EXPOSE 3000
WORKDIR ${ROOT_PATH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment