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

Dockerfile updates for traject #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
27 changes: 18 additions & 9 deletions Dockerfile
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"
32 changes: 27 additions & 5 deletions docker-compose.yml
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:
11 changes: 3 additions & 8 deletions lib/translation_maps/ht/collection_code_to_original_from.yaml
Copy link
Member Author

Choose a reason for hiding this comment

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

should revert this change

Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't be opposed to bringing this file up to date with whatever is in the production DB and then .gitignoreing it. I've run against problems using this repo (or maybe it was hathifiles) with a stale table like this, against real-world Zephir data (bails out due to inability to find a recent institution code). It'll always be a moving target, however. Maybe worth a note in the readme.

Copy link
Member Author

Choose a reason for hiding this comment

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

@moseshll If you have time to do that then we can go ahead and merge this.

Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ aubru: The University of Queensland
aztes: Arizona State University
chi: University of Chicago
coo: Cornell University
cou: University of Colorado Boulder
ctu: University of Connecticut
deu: University of Delaware
fmu: University of Miami
geu: Emory University
gri: Getty Research Institute
gu: University System of Georgia
gwla: Technical Report Archive &amp; Image Library
hvd: Harvard University
iagg: Grinnell College
iau: University of Iowa
ibc: Boston College
iduke: Duke University
Expand All @@ -30,8 +27,8 @@ iucla: University of California
iufl: State University System of Florida
iuiuc: University of Illinois at Urbana-Champaign
iunc: University of North Carolina at Chapel Hill
keio: 'Keio University 慶應義塾大学 '
lebau: American University of Beirut - الجامعة الأميركيّة في بيروت
keio: 慶應義塾大学 (Keio University)
lebau: American University of Beirut
mdbj: Johns Hopkins University
mdl: Minnesota Digital Library
mdu: University of Maryland, College Park
Expand All @@ -45,8 +42,6 @@ nbb: Brooklyn Museum
nbuu: University At Buffalo, The State University of New York
ncwsw: Wake Forest University
njp: Princeton University
njpt: Princeton Theological Seminary
njr: Rutgers University
nnc: Columbia University
nnfr: The Frick Collection
nrlf: University of California
Expand All @@ -65,7 +60,7 @@ srlf: University of California
tu: University of Tennessee, Knoxville
txcm: Texas A&amp;M University
txsmtsu: Texas State University - San Marcos
txu: The University of Texas
txu: University of Texas at Austin
ucbk: University of California
ucd: University of California
uci: University of California
Expand Down
Loading