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

Improvement: include all webapp locales in Dockerfile #37

Merged
merged 2 commits into from
Dec 1, 2023
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
build/
.gradle/
src/main/resources/config.js
src/main/resources/config.json
*.der
*.pem
Expand Down
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

FROM yarnpkg/node-yarn:latest as webappbuild

ARG LANGUAGE=en
FROM node:20 as webappbuild

# Build the webapp
COPY ./webapp/ /webapp/
RUN mkdir -p /www

WORKDIR /webapp
RUN yarn install && ./build.sh ${LANGUAGE}
RUN yarn install
RUN ./build.sh en && mv build /www/en
RUN ./build.sh nl && mv build /www/nl
# Let root redirect to the english version
RUN cp /webapp/redirect-en.html /www/index.html

FROM gradle:7.6-jdk11 as javabuild

Expand All @@ -18,9 +22,13 @@ RUN gradle build
FROM tomee:9.0-jre11

# Copy the webapp to the webapps directory
COPY --from=webappbuild /webapp/build/ /usr/local/tomee/webapps/ROOT/
RUN rm -rf /usr/local/tomee/webapps/ROOT
COPY --from=webappbuild /www/ /usr/local/tomee/webapps/ROOT/

# Copy the war file to the webapps directory
COPY --from=javabuild /app/build/libs/irma_email_issuer-1.1.0.war /usr/local/tomee/webapps/

EXPOSE 8080
EXPOSE 8080

# Copy the config file to the webapp. This is done at runtime so that the config file can be mounted as a volume.
CMD [ "/bin/sh", "-c", "for lang in 'en' 'nl'; do cp /config/config.js /usr/local/tomee/webapps/ROOT/$lang/assets/config.js; done && catalina.sh run" ]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ By default, docker-compose caches docker images, so on a second run the previous
$ IP=192.168.1.105 docker-compose up --build
```

The configuration should be mounted in the `/config` directory of the container. The `docker-compose.yml` file already contains this configuration.

## Manual
The Java api and JavaScript frontend can be built and run manually using the following commands:

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: irma_email_issuer
services:
# Irma issuer service
irmaserver:
image: ghcr.io/privacybydesign/irma:v0.13.2
image: ghcr.io/privacybydesign/irma:v0.14.2
working_dir: /irmago
ports:
- 8088:8088
Expand Down Expand Up @@ -45,7 +45,7 @@ services:
# Make keys and config files available for Java app
- ./src/main/resources/:/config/
# Make config.js available for webapp
- ./webapp/config.example.js:/usr/local/tomee/webapps/ROOT/assets/config.js:ro"
- ./webapp/config.example.js:/config/config.js:ro"
ports:
- 8080:8080
expose:
Expand Down
11 changes: 11 additions & 0 deletions webapp/redirect-en.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0;url=/en/">
<title>Redirecting...</title>
</head>
<body>
<p>If you are not redirected, <a href="/en/">click here</a>.</p>
</body>
</html>
Loading