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

Updates for Modern 7.2 #58

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-west-2

# SWITCH MYSQL: enable these environment
# MYSQL_URL=mysql
# MYSQL_DATABASE=starter_dev
S3_URL=http://s3:9090
AWS_BUCKET_NAME=files

SMTP_HOST=mailhog
SMTP_PORT=1025
SMTP_USERNAME=
SMTP_PASSWORD=
44 changes: 22 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Temporary files generated by your text editor or operating system
# belong in git's global ignore instead:
# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

/node_modules
/yarn-error.log

.byebug_history
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore Docker Volumes
.redis
# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
/public/assets

# Ignore Test Coverage
/coverage
# Ignore master key for decrypting credentials and more.
/config/master.key

# Ignore local config overrides
.env.development.local
/app/assets/builds/*
!/app/assets/builds/.keep

# Ignore local activestorage files
storage/
/node_modules

# General Ignores
.vscode/
Expand Down
3 changes: 0 additions & 3 deletions .rspec

This file was deleted.

4 changes: 1 addition & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
require:
- rubocop-factory_bot
- rubocop-performance
- rubocop-rails
- rubocop-rspec

inherit_gem:
prettier: rubocop.yml
inherit_gem: { rubocop-rails-omakase: rubocop.yml }

Rails:
Enabled: true
Expand Down
98 changes: 47 additions & 51 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,59 +1,55 @@
FROM ruby:3.1.3-bullseye AS deps

ENV DEBIAN_FRONTEND=noninteractive
ENV BUNDLE_BUILD__SASSC=--disable-march-tune-native

RUN apt update -qq \
&& apt install -qy \
build-essential \
ca-certificates \
curl \
gnupg \
# libmariadb-dev \ # SWITCH MYSQL: install mariadb, and remove postgresql
# mariadb-client \
postgresql-client-13 \
postgresql-contrib-13 \
&& rm -rf /var/lib/apt/lists/*


# Install Node. Requires curl, ca-certificates, gnupg from above
ENV NODE_MAJOR=18
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y nodejs && \
rm -rf /etc/apt/keyrings/nodesource.gpg /etc/apt/sources.list.d/nodesource.list

ENV BUNDLE_JOBS=5 \
BUNDLE_PATH=/bundle \
BUNDLE_BIN=/bundle/bin \
GEM_HOME=/bundle


RUN gem update --system
RUN gem install bundler

RUN bundle config set force_ruby_platform true

FROM public.ecr.aws/docker/library/ruby:3.2-alpine3.19 AS runner

ENV APP_HOME="/app"
ENV BUNDLE_BIN="/bundle/bin"
ENV DEBIAN_FRONTEND="noninteractive"
ENV BUNDLE_BUILD__SASSC="--disable-march-tune-native"
ENV BUNDLE_JOBS="5"
ENV BUNDLE_PATH="/bundle"
ENV GEM_HOME="/bundle"
ENV BUNDLE_GEMFILE="$APP_HOME/Gemfile"
ENV CHROME_BIN="/usr/bin/chromium"
ENV CHROME_PATH="/usr/lib/chromium/"
egreer marked this conversation as resolved.
Show resolved Hide resolved
ENV PATH="${BUNDLE_BIN}:${PATH}"

ENV APP_HOME /app
WORKDIR $APP_HOME

# Update Gems first...only re-do this when bundler version changes.
# If we need to force a gem update we'll have to `--no-cache` or add a file we can copy in
RUN gem update --system && gem install bundler:2.3.25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should upgrade bundler to latest version


FROM deps as dev

CMD ["tail", "-f", "/dev/null"]

FROM deps as runner

COPY Gemfile Gemfile.lock $APP_HOME/
ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile

RUN bundle check || bundle install

COPY . $APP_HOME/
COPY ./server/apk-updated-date.txt .
RUN apk add --update --no-cache \
alpine-sdk \
ca-certificates \
curl \
bash \
chromium \
fontconfig \
graphviz \
gcompat \
imagemagick \
imagemagick-jpeg \
imagemagick-pdf \
msttcorefonts-installer \
nodejs \
npm \
pandoc \
libpq-dev \
postgresql13-dev \
vips-dev \
&& rm ./apk-updated-date.txt \
&& npm install -g [email protected]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop font libraries, pandoc, chrome,

Do we need to upgrade postgresql13 or still latest library?


COPY ./server/Gemfile ./server/Gemfile.lock ./
RUN bundle install && rm ./Gemfile ./Gemfile.lock

COPY ./server/deploy/minimagick/policy.xml /etc/ImageMagick-6/
COPY ./server $APP_HOME/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change these all from ./server


# copy all font files to the font install directory, so chromium can use these fonts directly
# this way we don't have to embed fonts in the HTML
RUN find lib/assets/fonts -name '*.ttf' -exec ln '{}' /usr/share/fonts/ \;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop this


EXPOSE 3000

Expand Down
Loading