Skip to content

Commit d4c4d2a

Browse files
committed
Merge remote-tracking branch 'bitbucket4science/task/main-cris/DSC-2193' into task/dspace-cris-2024_02_x/DSC-2193
# Conflicts: # yarn.lock
2 parents c6a0d45 + 361420d commit d4c4d2a

11 files changed

Lines changed: 105 additions & 71 deletions

Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
# This image will be published as dspace/dspace-angular
22
# See https://github.com/DSpace/dspace-angular/tree/main/docker for usage details
33

4-
FROM docker.io/node:18-alpine
4+
ARG NODE_VERSION=22
5+
ARG DSPACE_VERSION=2024_02_x
6+
ARG DOCKER_REGISTRY=docker.io
57

6-
# Ensure Python and other build tools are available
7-
# These are needed to install some node modules, especially on linux/arm64
8-
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
8+
FROM ${DOCKER_REGISTRY:-docker.io}/4science/dspace-cris-angular-dependencies:${DSPACE_VERSION:-2024_02_x} AS dev
99

1010
WORKDIR /app
1111
ADD . /app/
1212
EXPOSE 4000
1313

14-
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
15-
# See, for example https://github.com/yarnpkg/yarn/issues/5540
16-
RUN yarn install --network-timeout 300000
17-
1814
# When running in dev mode, 4GB of memory is required to build & launch the app.
1915
# This default setting can be overridden as needed in your shell, via an env file or in docker-compose.
2016
# See Docker environment var precedence: https://docs.docker.com/compose/environment-variables/envvars-precedence/
@@ -25,4 +21,4 @@ ENV NODE_OPTIONS="--max_old_space_size=4096"
2521
# NOTE: At this time it is only possible to run Docker container in Production mode
2622
# if you have a public URL. See https://github.com/DSpace/dspace-angular/issues/1485
2723
ENV NODE_ENV=development
28-
CMD yarn serve --host 0.0.0.0
24+
CMD ["yarn", "serve", "--host", "0.0.0.0"]

Dockerfile.dependencies

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Test build:
2+
# docker build -f Dockerfile.dependencies -t 4science/dspace-angular-dependencies:2024_02_x .
3+
4+
# Angular 17 + Node 22 optimized Dockerfile
5+
ARG NODE_VERSION=22
6+
ARG DSPACE_VERSION=2024_02_X
7+
ARG DOCKER_REGISTRY=docker.io
8+
9+
FROM ${DOCKER_REGISTRY:-docker.io}/node:${NODE_VERSION-22}-alpine AS dependencies
10+
11+
# Install build dependencies
12+
RUN apk add --no-cache python3 make g++
13+
14+
WORKDIR /app
15+
16+
# Install dependencies (use npm ci if you have package-lock.json)
17+
COPY package.json yarn.lock ./
18+
RUN yarn install --network-timeout 300000

Dockerfile.dist

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
1+
# syntax=docker/dockerfile:1.7-labs
2+
13
# This image will be published as dspace/dspace-angular:$DSPACE_VERSION-dist
24
# See https://github.com/DSpace/dspace-angular/tree/main/docker for usage details
35

46
# Test build:
57
# docker build -f Dockerfile.dist -t dspace/dspace-angular:dspace-8_x-dist .
68

7-
FROM docker.io/node:18-alpine AS build
9+
# Angular 17 + Node 22 optimized Dockerfile
10+
ARG NODE_VERSION=22
11+
ARG DSPACE_VERSION=2024_02_x
12+
ARG DOCKER_REGISTRY=docker.io
13+
14+
FROM ${DOCKER_REGISTRY:-docker.io}/4science/dspace-cris-angular-dependencies:${DSPACE_VERSION:-2024_02_x} AS build
815

9-
# Ensure Python and other build tools are available
10-
# These are needed to install some node modules, especially on linux/arm64
11-
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
16+
COPY --parents src/** config/** webpack/** docker/dspace-ui.json angular.json server.ts startup-message.ts tsconfig.json tsconfig.app.json tsconfig.server.json tsconfig.spec.json tsconfig.ts-node.json typedoc.json /app/
1217

1318
WORKDIR /app
14-
COPY package.json yarn.lock ./
15-
RUN yarn install --network-timeout 300000
1619

17-
ADD . /app/
20+
# Build Angular app
1821
RUN yarn build:prod
1922

20-
FROM node:18-alpine
21-
RUN npm install --global pm2
23+
# ---- Production image ----
24+
FROM ${DOCKER_REGISTRY:-docker.io}/node:${NODE_VERSION-22}-alpine AS prod
2225

23-
COPY --chown=node:node --from=build /app/dist /app/dist
24-
COPY --chown=node:node config /app/config
25-
COPY --chown=node:node docker/dspace-ui.json /app/dspace-ui.json
26+
# Install pm2 globally and clean npm cache
27+
RUN npm install --global pm2 && npm cache clean --force
2628

2729
WORKDIR /app
30+
31+
# Only copy built files and config
32+
COPY --chown=node:node --from=build /app/dist /app/dist
33+
COPY --chown=node:node --from=build /app/config /app/config
34+
COPY --chown=node:node --from=build /app/docker/dspace-ui.json /app/dspace-ui.json
35+
2836
USER node
2937
ENV NODE_ENV=production
3038
EXPOSE 4000
31-
CMD pm2-runtime start dspace-ui.json --json
39+
40+
CMD ["pm2-runtime", "start", "dspace-ui.json", "--json"]

bitbucket-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ definitions:
2323

2424
pipelines:
2525
branches:
26-
'dspace-cris-2024_02_x':
26+
'main-cris':
2727
- step: *unittest-code-checks
2828
'prod/**':
2929
- step: *unittest-code-checks

docker/README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
***
44
:warning: **THESE IMAGES ARE NOT PRODUCTION READY** The below Docker Compose images/resources were built for development/testing only. Therefore, they may not be fully secured or up-to-date, and should not be used in production.
55

6-
If you wish to run DSpace on Docker in production, we recommend building your own Docker images. You are welcome to borrow ideas/concepts from the below images in doing so. But, the below images should not be used "as is" in any production scenario.
6+
If you wish to run DSpace-CRIS on Docker in production, we recommend building your own Docker images. You are welcome to borrow ideas/concepts from the below images in doing so. But, the below images should not be used "as is" in any production scenario.
77
***
88

99
## Overview
10-
The scripts in this directory can be used to start the DSpace User Interface (frontend) in Docker.
10+
The scripts in this directory can be used to start the DSpace-CRIS User Interface (frontend) in Docker.
1111
Optionally, the backend (REST API) might also be started in Docker.
1212

1313
For additional options/settings in starting the backend (REST API) in Docker, see the Docker Compose
@@ -20,17 +20,17 @@ the Docker compose scripts in this 'docker' folder.
2020

2121
### Dockerfile
2222

23-
This Dockerfile is used to build a *development* DSpace Angular UI image, published as 'dspace/dspace-angular'
23+
This Dockerfile is used to build a *development* DSpace-CRIS Angular UI image, published as '4science/dspace-cris-angular'
2424

2525
```
26-
docker build -t dspace/dspace-angular:dspace-8_x .
26+
docker build -t 4science/dspace-cris-angular:2024_02_x .
2727
```
2828

2929
This image is built *automatically* after each commit is made to the `main` branch.
3030

3131
Admins to our DockerHub repo can manually publish with the following command.
3232
```
33-
docker push dspace/dspace-angular:dspace-8_x
33+
docker push 4science/dspace-cris-angular:2024_02_x
3434
```
3535

3636
### Dockerfile.dist
@@ -39,45 +39,45 @@ The `Dockerfile.dist` is used to generate a *production* build and runtime envir
3939

4040
```bash
4141
# build the latest image
42-
docker build -f Dockerfile.dist -t dspace/dspace-angular:dspace-8_x-dist .
42+
docker build -f Dockerfile.dist -t 4science/dspace-cris-angular:2024_02_x-dist .
4343
```
4444

4545
A default/demo version of this image is built *automatically*.
4646

4747
## 'docker' directory
4848
- docker-compose.yml
49-
- Starts DSpace Angular with Docker Compose from the current branch. This file assumes that a DSpace REST instance will also be started in Docker.
49+
- Starts DSpace-CRIS Angular with Docker Compose from the current branch. This file assumes that a DSpace-CRIS REST instance will also be started in Docker.
5050
- docker-compose-rest.yml
51-
- Runs a published instance of the DSpace REST API - persists data in Docker volumes
51+
- Runs a published instance of the DSpace-CRIS REST API - persists data in Docker volumes
5252
- docker-compose-ci.yml
53-
- Runs a published instance of the DSpace REST API for CI testing. The database is re-populated from a SQL dump on each startup.
53+
- Runs a published instance of the DSpace-CRIS REST API for CI testing. The database is re-populated from a SQL dump on each startup.
5454
- cli.yml
55-
- Docker compose file that provides a DSpace CLI container to work with a running DSpace REST container.
55+
- Docker compose file that provides a DSpace-CRIS CLI container to work with a running DSpace-CRIS REST container.
5656
- cli.assetstore.yml
57-
- Docker compose file that will download and install data into a DSpace REST assetstore. This script points to a default dataset that will be utilized for CI testing.
57+
- Docker compose file that will download and install data into a DSpace-CRIS REST assetstore. This script points to a default dataset that will be utilized for CI testing.
5858

5959

60-
## To refresh / pull DSpace images from Dockerhub
60+
## To refresh / pull DSpace-CRIS images from Dockerhub
6161
```
6262
docker compose -f docker/docker-compose.yml pull
6363
```
6464

65-
## To build DSpace images using code in your branch
65+
## To build DSpace-CRIS images using code in your branch
6666
```
6767
docker compose -f docker/docker-compose.yml build
6868
```
6969

70-
## To start DSpace (REST and Angular) from your branch
70+
## To start DSpace-CRIS (REST and Angular) from your branch
7171

7272
This command provides a quick way to start both the frontend & backend from this single codebase
7373
```
74-
docker compose -p d8 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d
74+
docker compose -p c24 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d
7575
```
7676

7777
Keep in mind, you may also start the backend by cloning the 'DSpace/DSpace' GitHub repository separately. See the next section.
7878

7979

80-
## Run DSpace REST and DSpace Angular from local branches.
80+
## Run DSpace-CRIS REST and DSpace-CRIS Angular from local branches.
8181

8282
This section assumes that you have clones *both* the 'DSpace/DSpace' and 'DSpace/dspace-angular' GitHub
8383
repositories. When both are available locally, you can spin up both in Docker and have them work together.
@@ -86,59 +86,59 @@ _The system will be started in 2 steps. Each step shares the same docker network
8686

8787
From 'DSpace/DSpace' clone (build first as needed):
8888
```
89-
docker compose -p d8 up -d
89+
docker compose -p c24 up -d
9090
```
9191

9292
NOTE: More detailed instructions on starting the backend via Docker can be found in the [Docker Compose instructions for the Backend](https://github.com/DSpace/DSpace/blob/main/dspace/src/main/docker-compose/README.md).
9393

9494
From 'DSpace/dspace-angular' clone (build first as needed)
9595
```
96-
docker compose -p d8 -f docker/docker-compose.yml up -d
96+
docker compose -p c24 -f docker/docker-compose.yml up -d
9797
```
9898

9999
At this point, you should be able to access the UI from http://localhost:4000,
100100
and the backend at http://localhost:8080/server/
101101

102-
## Run DSpace Angular dist build with DSpace Demo site backend
102+
## Run DSpace-CRIS Angular dist build with DSpace-CRIS Demo site backend
103103

104104
This allows you to run the Angular UI in *production* mode, pointing it at the demo or sandbox backend
105105
(https://demo.dspace.org/server/ or https://sandbox.dspace.org/server/).
106106

107107
```
108108
docker compose -f docker/docker-compose-dist.yml pull
109109
docker compose -f docker/docker-compose-dist.yml build
110-
docker compose -p d8 -f docker/docker-compose-dist.yml up -d
110+
docker compose -p c24 -f docker/docker-compose-dist.yml up -d
111111
```
112112

113113
## Ingest test data from AIPDIR
114114

115115
Create an administrator
116116
```
117-
docker compose -p d8 -f docker/cli.yml run --rm dspace-cli create-administrator -e test@test.edu -f admin -l user -p admin -c en
117+
docker compose -p c24 -f docker/cli.yml run --rm dspace-cli create-administrator -e test@test.edu -f admin -l user -p admin -c en
118118
```
119119

120120
Load content from AIP files
121121
```
122-
docker compose -p d8 -f docker/cli.yml -f ./docker/cli.ingest.yml run --rm dspace-cli
122+
docker compose -p c24 -f docker/cli.yml -f ./docker/cli.ingest.yml run --rm dspace-cli
123123
```
124124

125125
## Alternative Ingest - Use Entities dataset
126126
_Delete your docker volumes or use a unique project (-p) name_
127127

128-
Start DSpace with Database Content from a database dump
128+
Start DSpace-CRIS with Database Content from a database dump
129129
```
130-
docker compose -p d8 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f docker/db.entities.yml up -d
130+
docker compose -p c24 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f docker/db.entities.yml up -d
131131
```
132132

133133
Load assetstore content and trigger a re-index of the repository
134134
```
135-
docker compose -p d8 -f docker/cli.yml -f docker/cli.assetstore.yml run --rm dspace-cli
135+
docker compose -p c24 -f docker/cli.yml -f docker/cli.assetstore.yml run --rm dspace-cli
136136
```
137137

138138
## End to end testing of the REST API (runs in GitHub Actions CI).
139139
_In this instance, only the REST api runs in Docker using the Entities dataset. GitHub Actions will perform CI testing of Angular using Node to drive the tests. See `.github/workflows/build.yml` for more details._
140140

141141
This command is only really useful for testing our Continuous Integration process.
142142
```
143-
docker compose -p d8ci -f docker/docker-compose-ci.yml up -d
143+
docker compose -p c24ci -f docker/docker-compose-ci.yml up -d
144144
```

docker/cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ networks:
2121
external: true
2222
services:
2323
dspace-cli:
24-
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace-cli:${DSPACE_VER:-dspace-8_x}"
24+
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-4science}/dspace-cris-cli:${DSPACE_VER:-2024_02_x}"
2525
container_name: dspace-cli
2626
environment:
2727
# Below syntax may look odd, but it is how to override dspace.cfg settings via env variables.

docker/db.entities.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
# # Therefore, it should be kept in sync with that file
1515
services:
1616
dspacedb:
17-
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace-postgres-pgcrypto:${DSPACE_VER:-dspace-8_x}-loadsql"
17+
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-4science}/dspace-cris-postgres-pgcrypto:${DSPACE_VER:-2024_02_x}-loadsql"
1818
environment:
19-
# This LOADSQL should be kept in sync with the URL in DSpace/DSpace
20-
# This SQL is available from https://github.com/DSpace-Labs/AIP-Files/releases/tag/demo-entities-data
19+
# This LOADSQL should be kept in sync with the URL in 4Science/DSpace
20+
# This SQL is available from https://github.com/4Science/DSpace-CRIS-Files/releases/download/cris-2024.02.00/db-entities.sql
2121
# NOTE: currently there is no dspace8 version
22-
- LOADSQL=https://github.com/DSpace-Labs/AIP-Files/releases/download/demo-entities-data/dspace7-entities-data.sql
22+
- LOADSQL=https://github.com/4Science/DSpace-CRIS-Files/releases/download/cris-2024.02.00/db-entities.sql
2323
dspace:
2424
### OVERRIDE default 'entrypoint' in 'docker-compose-rest.yml' ####
2525
# Ensure that the database is ready BEFORE starting tomcat
@@ -35,4 +35,4 @@ services:
3535
- |
3636
while (!</dev/tcp/dspacedb/5432) > /dev/null 2>&1; do sleep 1; done;
3737
/dspace/bin/dspace database migrate ignored
38-
java -jar /dspace/webapps/server-boot.jar --dspace.dir=/dspace
38+
java -XX:+UseParallelGC -XX:MaxRAMPercentage=75 org.springframework.boot.loader.launch.JarLauncher

docker/docker-compose-ci.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ services:
3333
# This allows us to generate statistics in e2e tests so that statistics pages can be tested thoroughly.
3434
solr__D__statistics__P__autoCommit: 'false'
3535
LOGGING_CONFIG: /dspace/config/log4j2-container.xml
36-
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-dspace-8_x-test}"
36+
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-4science}/dspace-cris:${DSPACE_VER:-2024_02_x}-test"
3737
depends_on:
3838
- dspacedb
3939
networks:
@@ -53,20 +53,21 @@ services:
5353
- /bin/bash
5454
- '-c'
5555
- |
56-
while (!</dev/tcp/dspacedb/5432) > /dev/null 2>&1; do sleep 1; done;
56+
/dspace/bin/dspace database repair
57+
/dspace/bin/dspace database migrate
5758
/dspace/bin/dspace database migrate ignored
58-
java -jar /dspace/webapps/server-boot.jar --dspace.dir=/dspace
59+
java -XX:+UseParallelGC -XX:MaxRAMPercentage=75 org.springframework.boot.loader.launch.JarLauncher
5960
# DSpace database container
6061
# NOTE: This is customized to use our loadsql image, so that we are using a database with existing test data
6162
dspacedb:
6263
container_name: dspacedb
63-
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace-postgres-pgcrypto:${DSPACE_VER:-dspace-8_x}-loadsql"
64+
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-4science}/dspace-cris-postgres-pgcrypto:${DSPACE_VER:-2024_02_x}-loadsql"
6465
environment:
6566
# This LOADSQL should be kept in sync with the LOADSQL in
6667
# https://github.com/DSpace/DSpace/blob/main/dspace/src/main/docker-compose/db.entities.yml
6768
# This SQL is available from https://github.com/DSpace-Labs/AIP-Files/releases/tag/demo-entities-data
6869
# NOTE: currently there is no dspace8 version
69-
LOADSQL: https://github.com/DSpace-Labs/AIP-Files/releases/download/demo-entities-data/dspace7-entities-data.sql
70+
LOADSQL: https://github.com/4Science/DSpace-CRIS-Files/releases/download/cris-2024.02.00/db-entities.sql
7071
PGDATA: /pgdata
7172
POSTGRES_PASSWORD: dspace
7273
networks:
@@ -82,7 +83,7 @@ services:
8283
# DSpace Solr container
8384
dspacesolr:
8485
container_name: dspacesolr
85-
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-dspace-8_x}"
86+
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-2024_02_x}"
8687
networks:
8788
- dspacenet
8889
ports:
@@ -112,6 +113,10 @@ services:
112113
cp -r /opt/solr/server/solr/configsets/qaevent/* qaevent
113114
precreate-core suggestion /opt/solr/server/solr/configsets/suggestion
114115
cp -r /opt/solr/server/solr/configsets/suggestion/* suggestion
116+
precreate-core dedup /opt/solr/server/solr/configsets/dedup
117+
cp -r /opt/solr/server/solr/configsets/dedup/* dedup
118+
precreate-core audit /opt/solr/server/solr/configsets/audit
119+
cp -r /opt/solr/server/solr/configsets/audit/* audit
115120
exec solr -f
116121
volumes:
117122
assetstore:

docker/docker-compose-dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ services:
2626
DSPACE_REST_HOST: sandbox.dspace.org
2727
DSPACE_REST_PORT: 443
2828
DSPACE_REST_NAMESPACE: /server
29-
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace-angular:${DSPACE_VER:-dspace-8_x}-dist"
29+
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-4science}/dspace-cris-angular:${DSPACE_VER:-2024_02_x}-dist"
3030
build:
3131
context: ..
3232
dockerfile: Dockerfile.dist

0 commit comments

Comments
 (0)