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

Document commands to run in dev docker containers #215

Closed
wants to merge 4 commits into from
Closed
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
14 changes: 7 additions & 7 deletions dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ The `docker-compose.yaml` file is constructed to prepare containers with all dep

```bash
cd /home/node/app
npm start
npm run start
```

### Backend-next `be_next`

```bash
cd /home/node/app
npm start
npm run start
```

### Frontend `fe`
Expand All @@ -86,30 +86,30 @@ The frontend uses a custom Dockerfile with the following modifications:

```bash
cd /frontend
npm start -- --host 0.0.0.0
npm run start -- --host 0.0.0.0 --disable-host-check
```

A custom Dockerfile is used because the production image uses the node alpine base image which does not crosscompile on macOS.
A custom Dockerfile is used because the production image builds the static site and then serves it via nginx. The development image serves the site using `ng serve` (webpack-dev-server) so it reflects the latest code and updates when files change.
Copy link
Collaborator

Choose a reason for hiding this comment

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

does the official image work on your mac? Because the alpine version of node did not work on mac for me. If this is the case for you as well, I would keep the comment as is and also keep the custom image with stages and the docker-file with target

Copy link
Member Author

Choose a reason for hiding this comment

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

nginx:1.2-alpine doesn't work on arm64. Newer versions of nginx do. We should update all our images to use a recent alpine version.


### Search `search`

```
cd /home/node/app
npm start
npm run start
```

### Landing Page `lp`

```bash
cd /home/node/app
npm start -- --host 0.0.0.0
npm run start -- --host 0.0.0.0 --disable-host-check
```

### OAI-PMH `oi`

```bash
cd /home/node/app
npm start
npm run start
```

### Proposals `pr`
Expand Down
16 changes: 4 additions & 12 deletions dev/config/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
FROM node:16 AS installer

WORKDIR /frontend
COPY package*.json /frontend/
RUN npm ci
COPY . /frontend/
# A browser is needed for automated tests
RUN apt-get update && apt-get install -y chromium
ENV CHROME_BIN=/usr/bin/chromium
ENV CHROME_PATH=/usr/lib/chromium/

FROM node:16 AS builder
WORKDIR /frontend
COPY --from=installer /frontend /frontend
COPY package*.json /frontend/

RUN npx ng build
RUN npm ci

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
EXPOSE 4200
CMD ["node serve"]
5 changes: 3 additions & 2 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ services:
build:
context: ../frontend/.
dockerfile: ../dev/config/frontend/Dockerfile
target: installer
volumes:
- ../frontend:/frontend
- ./config/frontend/config.json:/frontend/src/assets/config.json
- /frontend/node_modules
- /frontend/dist
command: /bin/sh -c "while true; do sleep 600; done"
ports:
# Dev image with `node start` uses port 4200
# For the upstream dockerfile with nginx, use 4200:80
- 4200:4200

profiles:
- fe

Expand Down
Loading