Skip to content

Instantly share code, notes, and snippets.

@elithecho
Created October 31, 2023 23:03
Show Gist options
  • Save elithecho/f422bf9a82480f056afc414c5f34f535 to your computer and use it in GitHub Desktop.
Save elithecho/f422bf9a82480f056afc414c5f34f535 to your computer and use it in GitHub Desktop.
Render Dockerfile deployment
# syntax = docker/dockerfile:1.2
FROM timbru31/ruby-node:3.2-slim
ENV RAILS_LOG_TO_STDOUT=true
RUN --mount=type=secret,id=_env,dst=/etc/secrets/.env cat /etc/secrets/.env
RUN corepack enable && \
corepack prepare yarn@stable --activate
RUN apt-get update && \
apt-get install -y curl gnupg2 dirmngr apt-transport-https ca-certificates libpq-dev build-essential exiftool \
libjemalloc2
RUN apt-get install -y libvips-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY Gemfile Gemfile.lock ./
ENV BUNDLE_PATH=/bundle_cache
RUN bundle install --jobs $(nproc) --retry 3
COPY . ./
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 \
RUBY_YJIT_ENABLE="1"
# Precompile bootsnap code for faster boot times
RUN rm -rf /app/tmp/cache
RUN bundle exec bootsnap precompile --gemfile app/ lib/
COPY package.json yarn.lock ./
RUN yarn set version stable
RUN yarn install
RUN bundle exec rails assets:precompile
EXPOSE 3000
CMD ["/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment