Skip to content

Instantly share code, notes, and snippets.

@mudhappy
Created November 29, 2022 17:43
Show Gist options
  • Save mudhappy/7aa2e798262c67a01accd18a0e872fa7 to your computer and use it in GitHub Desktop.
Save mudhappy/7aa2e798262c67a01accd18a0e872fa7 to your computer and use it in GitHub Desktop.
Dockerfile silicon
FROM ruby:2.7.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
# yarn
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1646B01B86E50310
RUN echo 'deb https://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get update -qq \
&& apt-get install -y \
postgresql-client \
vim \
nodejs \
yarn \
libcurl4
RUN npm install --global mjml@4.5.1
RUN npm install
ENV APP_HOME /app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
# Bundle path to cache
ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \
BUNDLE_JOBS=2 \
BUNDLE_PATH=/usr/local/bundle \
GEM_HOME=/usr/local/bundle
RUN bundle config set force_ruby_platform true
ADD Gemfile* $APP_HOME/
RUN gem update --system
RUN bundle install
ADD . $APP_HOME
RUN echo -n 'export PATH="$APP_HOME/bin:$PATH"' >> ~/.bashrc
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment