Skip to content

Commit

Permalink
Update Dockerfile to use debian slim
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Feb 21, 2025
1 parent cd461d8 commit 4bd3720
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ test
vendor
coverage/
.bundle
.ruby-version

.DS_Store
.AppleDouble
Expand Down
43 changes: 21 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
FROM ruby:3.4.2-alpine
FROM ruby:3.4.2-slim

ENV APP_ROOT /usr/src/app
ENV DATABASE_PORT 5432
ENV APP_ROOT=/usr/src/app
ENV DATABASE_PORT=5432
WORKDIR $APP_ROOT

# =============================================
# System layer

# Will invalidate cache as soon as the Gemfile changes
COPY Gemfile Gemfile.lock $APP_ROOT/

# * Setup system
# * Install Ruby dependencies
RUN apk add --update \
build-base \
netcat-openbsd \
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
nodejs \
postgresql-dev \
libpq-dev \
tzdata \
curl-dev \
libc6-compat \
curl \
libyaml-dev \
libcurl4-openssl-dev \
libgit2-dev \
cmake \
libarchive-tools \
&& rm -rf /var/cache/apk/* \
&& gem update --system \
&& gem install bundler foreman \
&& bundle config --global frozen 1 \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

# Will invalidate cache as soon as the Gemfile changes
COPY Gemfile Gemfile.lock .ruby-version $APP_ROOT/

RUN bundle config --global frozen 1 \
&& bundle config set without 'test' \
&& bundle install --jobs 2

Expand All @@ -36,9 +33,11 @@ RUN apk add --update \
# Copy application code
COPY . $APP_ROOT

RUN bundle exec bootsnap precompile --gemfile app/ lib/

# Precompile assets for a production environment.
# This is done to include assets in production images on Dockerhub.
RUN RAILS_ENV=production bundle exec rake assets:precompile
RUN SECRET_KEY_BASE=1 RAILS_ENV=production bundle exec rake assets:precompile

# Startup
CMD ["bin/docker-start"]
CMD ["bin/docker-start"]

0 comments on commit 4bd3720

Please sign in to comment.