Skip to content

Instantly share code, notes, and snippets.

@stefanvermaas
Last active June 11, 2022 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanvermaas/99806f010ed918fcc8b0c3913f48bf04 to your computer and use it in GitHub Desktop.
Save stefanvermaas/99806f010ed918fcc8b0c3913f48bf04 to your computer and use it in GitHub Desktop.
A Dockerfile to automatically deploy a Bridgetown site to Digital Ocean's App Platform
FROM ruby:3.1.2-slim-buster
# Install dependencies
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
build-essential \
gnupg2 \
curl \
less \
git \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log
# Add NodeJS to sources list
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
# Add Yarn to the sources list
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo 'deb http://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list
# Install runtime dependencies.
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
nodejs \
yarn && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
truncate -s 0 /var/log/*log
# Configure bundler
ENV LANG=C.UTF-8 \
BUNDLE_JOBS=4 \
BUNDLE_RETRY=3
# Upgrade RubyGems and setup Bundler version.
RUN gem update --system && \
gem install bundler && \
bundle config set --local without development
# Create a directory for the app code.
COPY . /app
WORKDIR /app
# Install all dependencies ruby and JS dependencies.
RUN bundle install && yarn
# Configure and deploy website.
ENV BRIDGETOWN_ENV=production
RUN bin/bridgetown deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment