forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathDockerfile.dist
More file actions
41 lines (28 loc) · 1.17 KB
/
Dockerfile.dist
File metadata and controls
41 lines (28 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# syntax=docker/dockerfile:1.7-labs
# This image will be published as dspace/dspace-angular:$DSPACE_VERSION-dist
# See https://github.com/4science/dspace-angular/tree/main/docker for usage details
# Test build:
# docker build -f Dockerfile.dist -t 4science/dspace-angular:dspace-cris-2025_02_x-dist .
# Angular 20 + Node 22 optimized Dockerfile
ARG NODE_VERSION=22
ARG DSPACE_VERSION=dspace-cris-2025_02_x
ARG DOCKER_REGISTRY=docker.io
FROM ${DOCKER_REGISTRY:-docker.io}/4science/dspace-cris-angular-dependencies:${DSPACE_VERSION:-dspace-cris-2025_02_x} AS build
COPY . /app/
WORKDIR /app
# Build Angular app
RUN npm run build:prod
RUN npm run build:mirador
# ---- Production image ----
FROM docker.io/node:${NODE_VERSION-22}-alpine AS prod
# Install pm2 globally and clean npm cache
RUN npm install --global pm2 && npm cache clean --force
WORKDIR /app
# Only copy built files and config
COPY --chown=node:node --from=build /app/dist /app/dist
COPY --chown=node:node --from=build /app/config /app/config
COPY --chown=node:node --from=build /app/docker/dspace-ui.json /app/dspace-ui.json
USER node
ENV NODE_ENV=production
EXPOSE 4000
CMD ["pm2-runtime", "start", "dspace-ui.json", "--json"]