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

Fixing Dockerfile & upgrade Yarn packages #104

Merged
merged 5 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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 npm@10.5.2 && \
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