-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove wait-for & use health checks * use production stage
- Loading branch information
Showing
3 changed files
with
48 additions
and
22 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 |
---|---|---|
@@ -1,21 +1,30 @@ | ||
FROM jruby:9.4-jdk17 | ||
FROM jruby:9.4-jdk17 AS base | ||
ARG UNAME=app | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
|
||
RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \ | ||
build-essential \ | ||
netbase \ | ||
netcat | ||
netbase | ||
|
||
RUN groupadd -g ${GID} -o ${UNAME} | ||
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME} | ||
RUN mkdir -p /gems && chown ${UID}:${GID} /gems | ||
|
||
# COPY --chown=${UID}:${GID} Gemfile* /app/ | ||
WORKDIR /app | ||
RUN wget -O /usr/local/bin/wait-for https://github.com/eficode/wait-for/releases/download/v2.2.3/wait-for && chmod +x /usr/local/bin/wait-for | ||
|
||
# USER $UNAME | ||
ENV BUNDLE_PATH /gems | ||
RUN gem install bundler | ||
|
||
FROM base AS development | ||
|
||
FROM base AS production | ||
|
||
RUN groupadd -g $GID -o $UNAME | ||
RUN useradd -m -d /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* /app | ||
WORKDIR /app | ||
ENV BUNDLE_PATH /gems | ||
RUN bundle install | ||
COPY --chown=$UID:$GID . /app | ||
|
||
LABEL org.opencontainers.image.source="https://github.com/hathitrust/hathitrust_catalog_indexer" |
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,38 +1,60 @@ | ||
--- | ||
|
||
x-condition-healthy: &healthy | ||
condition: service_healthy | ||
|
||
x-healthcheck-defaults: &healthcheck-defaults | ||
interval: 5s | ||
timeout: 10s | ||
start_period: 10s | ||
retries: 5 | ||
|
||
services: | ||
traject: | ||
build: . | ||
build: | ||
context: . | ||
target: development | ||
volumes: | ||
- .:/app | ||
- gem_cache:/gems | ||
environment: | ||
- SOLR_URL=http://solr-sdr-catalog:9033/solr/catalog | ||
- redirect_file=/dev/null | ||
- NO_DB=1 | ||
network_mode: host | ||
command: sleep infinity | ||
|
||
test: | ||
build: . | ||
build: | ||
context: . | ||
target: development | ||
volumes: | ||
- .:/app | ||
- gem_cache:/gems | ||
command: bash -c "wait-for solr-sdr-catalog:9033 mariadb:3306 && JRUBY_OPTS='--debug' bundle exec rspec" | ||
command: bundle exec rspec | ||
environment: | ||
- JRUBY_OPTS=--debug | ||
- SOLR_URL=http://solr-sdr-catalog:9033/solr/catalog | ||
- redirect_file=/dev/null | ||
depends_on: | ||
- solr-sdr-catalog | ||
- mariadb | ||
solr-sdr-catalog: *healthy | ||
mariadb: *healthy | ||
|
||
solr-sdr-catalog: | ||
build: solr | ||
ports: | ||
- "9033:9033" | ||
healthcheck: | ||
<<: *healthcheck-defaults | ||
test: [ "CMD", "curl","-s","-f","http://localhost:9033/solr/catalog/admin/ping" ] | ||
|
||
mariadb: | ||
image: ghcr.io/hathitrust/db-image:latest | ||
ports: | ||
- "3306:3306" | ||
healthcheck: | ||
<<: *healthcheck-defaults | ||
test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ] | ||
|
||
volumes: | ||
gem_cache: |
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