Skip to content

Instantly share code, notes, and snippets.

@prsanjay
Created August 6, 2019 06:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save prsanjay/f994e313df665bebcffbd0465b4ff653 to your computer and use it in GitHub Desktop.
Save prsanjay/f994e313df665bebcffbd0465b4ff653 to your computer and use it in GitHub Desktop.
Dockerfile that install package manually from .deb file
FROM ruby:2.6.1
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash \
&& apt-get update && apt-get install -y nodejs xvfb libfontconfig wkhtmltopdf && rm -rf /var/lib/apt/lists/* \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update && apt-get install -y yarn && rm -rf /var/lib/apt/lists/*
# Packages for wkhtmltopdf. These are available in ubuntu but not in debian 9. Base image uses debian 9.
RUN wget -q -O /tmp/libjpeg-turbo8.deb http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.1-0ubuntu2_amd64.deb \
&& dpkg -i /tmp/libjpeg-turbo8.deb \
&& rm /tmp/libjpeg-turbo8.deb
RUN wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
&& dpkg -i /tmp/libpng12.deb \
&& rm /tmp/libpng12.deb
RUN mkdir /app
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN gem install bundler
RUN yarn install --check-files
RUN bundle install --jobs 20
COPY . /app
# Add a script to be executed every time the container starts.
COPY app_server_entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/app_server_entrypoint.sh
ENTRYPOINT ["app_server_entrypoint.sh"]
EXPOSE 3001
# Start the main process.
CMD ["rails", "server", "-p", "3001", "-b", "0.0.0.0"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment