Skip to content

Commit

Permalink
Merge pull request #104 from fnf-org/kig/dockerfile-fix
Browse files Browse the repository at this point in the history
Fixing Dockerfile & upgrade Yarn packages
  • Loading branch information
kigster authored Apr 26, 2024
2 parents 6b65640 + 83cbc7a commit 6d2d1f7
Show file tree
Hide file tree
Showing 5 changed files with 4,038 additions and 8,060 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Docker Image
name: "Publish Docker Image"

on:
push:
Expand Down Expand Up @@ -53,6 +53,12 @@ jobs:
type=sha,prefix={{branch}}-{{sha}},event=workflow_dispatch
type=raw,value={{date 'YYYYMMDD-HHmm' tz='America/Los_Angeles'}}-rc,event=branch,branch={{is_default_branch}}
- shell: bash
env:
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: echo -n "${RAILS_MASTER_KEY}" > config/master.key

# build-push-action v5.3.0
- name: Build and push Docker image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ RUN npm install -g [email protected] && \
rm -rf /tmp/node-build-master

# Install application gems
COPY Gemfile Gemfile.lock ./
COPY .ruby-version Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile
Expand Down Expand Up @@ -88,6 +88,9 @@ EXPOSE 3000

RUN chmod 755 /rails/bin/docker-entrypoint

# Remove master key so that the Docker image does not have it
RUN rm -f config/master.key

ENV RAILS_ENV=production

# Entrypoint prepares the database.
Expand Down
5 changes: 5 additions & 0 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ if [[ -z "${LD_PRELOAD+x}" ]] && [[ -f /usr/lib/*/libjemalloc.so.2 ]]; then
export LD_PRELOAD="$(echo /usr/lib/*/libjemalloc.so.2)"
fi

# Create config/master.key from the env variable
if [[ -n ${RAILS_MASTER_KEY} && ! -s config/master.key ]]; then
echo -n ${RAILS_MASTER_KEY} > config/master.key
fi

# If running the rails server then create or migrate existing database
if [[ "${1}" == "./bin/rails" ]] && [[ "${2}" == "server" ]]; then
./bin/rails db:prepare
Expand Down
Loading

0 comments on commit 6d2d1f7

Please sign in to comment.