Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: switch to alpine linux #416

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.3.5
ruby-3.3.6
32 changes: 13 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
FROM ruby:3.3.5-slim-bookworm AS builder

RUN apt update && apt install -y \
g++ \
gcc \
make \
libstdc++-12-dev \
libffi-dev \
libc-dev \
libxml2-dev \
libxslt-dev \
libgcrypt-dev \
libsqlite3-dev \
sqlite3 \
# not needed for gems, but for runtime
git \
tzdata \
&& rm -rf /var/lib/apt/lists/*
FROM ruby:3.3.6-alpine3.20 AS builder

RUN apk update \
&& apk upgrade \
&& apk add --no-cache --update \
git \
sqlite \
alpine-sdk \
libxml2-dev \
libxslt-dev \
tzdata \
bash

ENV APP_HOME=/hdm
WORKDIR $APP_HOME
Expand All @@ -27,7 +21,7 @@ RUN bundle check || (bundle config set --local without 'development test release

###############################################################################

FROM ruby:3.3.5-slim-bookworm
FROM ruby:3.3.6-alpine3.20 AS final

ENV APP_HOME=/hdm
ENV RAILS_ENV=production
Expand Down
11 changes: 10 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,13 @@ gem 'git'
gem 'gitable', require: "gitable/uri"

# dependencies & sec fixes
gem 'mini_racer' # minimal Google V8 JS engine for execjs
gem 'mini_racer', '~> 0.16.0' # minimal Google V8 JS engine for execjs
gem 'libv8-node', '~> 18.19.0.0' # V8 JS engine

# Alpine specific
#
# There is an issue with rails -> sass-embedded -> libv8-node -> protobuf
#
# We have to force bundler to compile protobuf on the current platform
# and do not download precompile binary-gems, otherwise the usage of relying gems will segfault
gem 'google-protobuf', force_ruby_platform: true
rwaffen marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading