-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use health checks & multi-stage builds in docker compose
* add base/dev/prod stage rather than Dockerfile vs Dockerfile.prod * use docker compose health checks instead of wait-for
- Loading branch information
Showing
9 changed files
with
86 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ jobs: | |
uses: hathitrust/github_actions/[email protected] | ||
with: | ||
image: ghcr.io/hathitrust/holdings-client-unstable | ||
dockerfile: Dockerfile.prod | ||
img_tag: ${{ inputs.img_tag }} | ||
tag: ${{ inputs.ref }} | ||
push_latest: ${{ inputs.push_latest}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,10 @@ jobs: | |
run: ./bin/setup/setup_test.sh | ||
|
||
- name: Run standardrb | ||
run: docker compose run --rm dev bundle exec standardrb | ||
run: docker compose run --rm test bundle exec standardrb | ||
|
||
- name: Run tests | ||
run: docker compose run --rm -e MONGOID_ENV=test dev bin/setup/wait-for mariadb:3306 pushgateway:9091 redis:6379 -- bundle exec rspec | ||
run: docker compose run --rm test | ||
|
||
- name: Report to Coveralls | ||
uses: coverallsapp/[email protected] | ||
with: | ||
github-token: ${{ secrets.github_token }} | ||
uses: coverallsapp/github-action@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
FROM ruby:3.3 | ||
ARG UNAME=holdings | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
FROM ruby:3.3 AS base | ||
|
||
RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \ | ||
nodejs netcat-openbsd rclone less entr uchardet | ||
nodejs rclone uchardet | ||
|
||
WORKDIR /usr/src/app | ||
ENV BUNDLE_PATH /gems | ||
ENV RUBYLIB /usr/src/app/lib | ||
RUN gem install bundler | ||
|
||
FROM base AS dev | ||
RUN apt-get install -yqq --no-install-recommends less entr | ||
|
||
FROM base AS prod | ||
LABEL org.opencontainers.image.source https://github.com/hathitrust/holdings-backend | ||
|
||
ARG UNAME=holdings | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
|
||
RUN groupadd -g $GID -o $UNAME | ||
RUN useradd -m -d /usr/src/app -u $UID -g $GID -o -s /bin/bash $UNAME | ||
RUN mkdir -p /gems && chown $UID:$GID /gems | ||
USER $UNAME | ||
|
||
COPY --chown=$UID:$GID Gemfile* /usr/src/app/ | ||
RUN bundle install | ||
COPY --chown=$UID:$GID . /usr/src/app |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters