Skip to content

Commit

Permalink
Add docker-compose container for lp and oaipmh
Browse files Browse the repository at this point in the history
  • Loading branch information
minottic committed Dec 13, 2022
1 parent 6581b7c commit c013870
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 5 deletions.
4 changes: 1 addition & 3 deletions dev/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# How to get started:

If running on MACOS, because of platform differences, please change the image in the frontend Dockerfile from `node:16-alpine` to `node:16`.

After that, if needed, build the docker containers with the suitable [profiles](https://docs.docker.com/compose/profiles/):
Build the docker containers with the suitable [profiles](https://docs.docker.com/compose/profiles/):

```bash
MY_PROFILE=<USER_INPUT>
Expand Down
18 changes: 18 additions & 0 deletions dev/config/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:16 AS installer

WORKDIR /frontend
COPY package*.json /frontend/
RUN npm ci
COPY . /frontend/

FROM node:16 AS builder
WORKDIR /frontend
COPY --from=installer /frontend /frontend

RUN npx ng build

FROM nginx:1.12-alpine
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /frontend/dist/ /usr/share/nginx/html/
COPY scripts/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
33 changes: 33 additions & 0 deletions dev/config/landing-page-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:16 AS installer

RUN apt update && apt -y upgrade && \
apt install -y bash git

# Prepare app directory
WORKDIR /home/node/app
COPY package*.json /home/node/app/

# set up local user to avoid running as root
RUN chown -R node:node /home/node/app
USER node

# Install our packages
RUN npm ci
COPY --chown=node:node . /home/node/app/

# Build app
FROM node:16 as builder

ARG env=production
WORKDIR /home/node/app
COPY --from=installer /home/node/app /home/node/app

RUN npx ng build --configuration=${env}

FROM nginx:1.22.0-alpine

RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /home/node/app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 80
14 changes: 14 additions & 0 deletions dev/config/oaipmh/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
HOST_CONFIGURATION=server/host_config.json
APP_ID=oai-pmh-service
BASE_URL=http://localhost:3001
SCICAT_ROUTE=/oaipmh/oai
LOG_LEVEL=debug
REQUEST_LIMIT=100kb
MASTER_ENV_FILE=oai-providerservice/.env
DB_URL=mongodb/oaipmh
DATABASE=oaipmh
COLLECTION=PublishedData
COLLECTION_ID=_id
NAME=oai-mongo
CONNECTOR=mongodb
ADMIN_USER_EMAIL=[email protected]
44 changes: 42 additions & 2 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ services:
mongodb:
image: mongo
volumes:
- mongodb_data:/bitnami
- mongodb_data:/data/db
profiles:
- legacy
- be
- be_next
- next
- search_legacy
- search_next
- lp_legacy
- lp_next
- oi_next
- oi_legacy
- oi_lp

backend:
build: ../backend/.
Expand All @@ -31,11 +36,14 @@ services:
- be
- legacy
- search_legacy
- lp_legacy
- oi_legacy

frontend:
build:
context: ../frontend/.
target: builder
target: installer
dockerfile: ../dev/config/frontend/Dockerfile
environment:
CHROME_BIN: /usr/bin/chromium
CHROME_PATH: /usr/lib/chromium/
Expand Down Expand Up @@ -80,6 +88,8 @@ services:
- be_next
- next
- search_next
- lp_next
- oi_next

jupyter:
image: python:3.10
Expand Down Expand Up @@ -107,6 +117,36 @@ services:
- search_next
- search_legacy

landing_page:
build:
context: ../landing-page-server/.
target: installer
dockerfile: ../dev/config/landing-page-server/Dockerfile
volumes:
- ../landing-page-server:/home/node/app
- /home/node/app/node_modules
- /home/node/app/dist
command: /bin/sh -c "npm ci && while true; do sleep 600; done"
profiles:
- lp
- lp_next
- lp_legacy
- oi_lp

oaipmh:
build: ../oaipmh/.
volumes:
- ../oaipmh:/home/node/app
- ./config/oaipmh/.env:/home/node/app/production/.env
- /home/node/app/node_modules
- /home/node/app/dist
command: /bin/sh -c "npm ci && while true; do sleep 600; done"
profiles:
- oi
- oi_next
- oi_legacy
- oi_lp

volumes:
mongodb_data:
driver: local

0 comments on commit c013870

Please sign in to comment.