Skip to content

Commit f87b8f4

Browse files
author
Maikel Maas
committed
Merge branch 'develop' of github.com:Sphereon-Opensource/OID4VC-demo into feat/VDX-308-env-subst
# Conflicts: # packages/agent/conf/demos/sphereon/oid4vci_metadata/sphereon.json # packages/agent/conf/demos/sphereon/oid4vci_options/sphereon.json
2 parents 81a005a + dfca752 commit f87b8f4

61 files changed

Lines changed: 722 additions & 673 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
**/*.env*
2+
!**/.env.example
3+
packages/agent/conf/dev
4+
5+
#docker files
6+
/docker
7+
18
# dependencies
2-
/node_modules
3-
onto-demo-client/node_modules
4-
siopv2-openid4vp-demo-backend/node_modules
5-
onto-demo-shared-types/node_modules
9+
**/node_modules
610
/.pnp
711
.pnp.js
812

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ yarn.lock
3737

3838
.idea
3939

40+
#docker
41+
/docker/compose/build
42+
!/docker/compose/build/docker-compose.yml
43+
!/docker/compose/build/install-configs.sh

README.md

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ And a scenario for using Verifiable Credential(s) For OID4VP flow:
6464
![OID4VP flow](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/Sphereon-Opensource/OID4VC-demo/develop/documents/oid4vp-flow.puml)
6565

6666
# Step by Step instructions
67+
6768
In the next chapters we're going to show you how to setup the `agent` module, oid4vci-demo-front-end and a brief
6869
introduction on how credential branding actually works.
6970

@@ -73,28 +74,62 @@ introduction on how credential branding actually works.
7374

7475
### Docker
7576

76-
From the root folder run:
77+
We maintain Docker a setup for building and testing in directory `docker/compose/build`.
78+
We have created a script to install and patch the agent configurations for you required to build and run the Docker
79+
containers.
80+
It's located here: `docker/compose/build/install-configs.sh <ecosystem> <agent host address>`.
81+
**IMPORTANT:** The host address should be either a DNS host or a LAN IP that is reachable for your mobile devices running SSI wallet
82+
software. For example:
7783

7884
```bash
79-
docker-compose build
80-
docker-compose up
85+
install-configs.sh sphereon http://192.168.1.100:5000
8186
```
8287

83-
The build phase might take a few minutes. If you run the docker-compose up command 3 services will be running. The
84-
ssi-agent, oid4vci-demo-frontend and oid4vp-frontend.
88+
The install-configs.sh script will set up the environment for your containers using the .env.examples files from
89+
packages/**src/.env.example and put them in the directories under `docker/compose/build`:
8590

86-
You should now be able to go to http://host.docker.internal:5001 and http://host.docker.internal:5002 respectively to
87-
test the issuer and verifier demo's.
91+
```
92+
oid4vci-demo-frontend/.env.local
93+
oid4vp-demo-frontend/.env.local
94+
agent/.env.local
95+
```
8896

89-
Please note that you might have to configure your docker environment to expose the host.docker.internal like the image
90-
below. If you cannot make that work you could adjust the config/docker and docker/*.env files to suit your needs
97+
(The .env.local files are copied and patched from the packages/**/src/.env.example files)
9198

99+
Please ensure that you execute the script and docker compose commands with ./docker/compose/build as working directory
100+
and have correctly set up your environment
101+
variables as outlined in the documentation for [Setting up the agent](./documents/agent-setup.md)
102+
and [Setting up the VCI frontend](./documents/vci-front-end.md).
103+
104+
The current example for ecosystem "sphereon" loads the folder `packages/agent/conf/demos/sphereon` as your base
105+
configuration folder.
106+
All ecosystems present in packages/agent/conf/demos can be installed using the install-configs.sh script.
107+
108+
To build and run the Docker containers, execute the following commands from within the respective directory:
109+
110+
```bash
111+
docker compose build # This builds the Docker images
112+
docker compose up -d # This starts the Docker containers, this will require the .env & config files to be installed
113+
```
114+
115+
The building process may take a few minutes. Once you execute the docker compose up command, three services will start:
116+
ssi-agent, oid4vci-demo-frontend, and oid4vp-frontend.
117+
118+
You should now be able to go to http://localhost:5001 and http://localhost:5002 respectively to test the issuer and
119+
verifier demo's.
120+
121+
Please note that you might have to configure your docker environment to expose the host.docker.internal like the image
122+
below. If you cannot make that work you could adjust the config/docker and docker/compose/build/**/.env* files to suit
123+
your needs.
92124
<img src="resources/docker_settings.png" width="500" />
93125

94-
#### Environment variables and configuration for docker.
126+
To build the images without docker-compose you can also just use "docker build" in the project root directory with some
127+
parameters:
128+
129+
```shell
130+
docker build -f ./docker/Dockerfile -t oid4vc-demo-ssi-agent:latest --build-arg="PACKAGE_PATH=packages/agent" --build-arg="NODE_SCRIPT=start:dev" .
131+
docker build -f ./docker/Dockerfile -t oid4vci-demo-frontend:latest --build-arg="PACKAGE_PATH=packages/oid4vci-demo-frontend" --build-arg="NODE_SCRIPT=start:prod" .
132+
docker build -f ./docker/Dockerfile -t oid4vp-demo-frontend:latest --build-arg="PACKAGE_PATH=packages/oid4vp-demo-frontend" --build-arg="NODE_SCRIPT=start:prod" .
133+
```
95134

96-
Please note that the environment variables for the 3 images come from the ./docker folder. You will have to copy the 3
97-
example files and remove the .example suffix.
98135

99-
The configuration files are copied over to the agent image. So the above explained configuration options also apply when
100-
running in docker.

docker-compose.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

docker/.env.oid4vci-demo-frontend

Lines changed: 0 additions & 3 deletions
This file was deleted.

docker/.env.oid4vp-demo-frontend

Lines changed: 0 additions & 5 deletions
This file was deleted.

docker/.env.ssi-agent

Lines changed: 0 additions & 13 deletions
This file was deleted.

docker/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Builder stage
2+
FROM node:lts-bookworm AS oid4vc-demo-builder
3+
SHELL ["/bin/bash", "-c"]
4+
RUN npm -g install pnpm && SHELL=bash pnpm setup && source /root/.bashrc && pnpm add -g pnpm
5+
RUN pnpm add typescript tslib
6+
WORKDIR /opt/oid4vc-demo
7+
8+
COPY /. .
9+
RUN rm -rf /root/.local/share/pnpm/store
10+
RUN pnpm install -r
11+
RUN pnpm build
12+
13+
# Final stage
14+
FROM node:lts-bookworm
15+
ARG PACKAGE_PATH
16+
ARG NODE_SCRIPT
17+
ENV NODE_SCRIPT=${NODE_SCRIPT}
18+
COPY --from=oid4vc-demo-builder /opt/oid4vc-demo/${PACKAGE_PATH} /opt/oid4vc-demo/${PACKAGE_PATH}
19+
# package node_modules has symlinks to root node_modules
20+
COPY --from=oid4vc-demo-builder /opt/oid4vc-demo/node_modules /opt/oid4vc-demo/node_modules
21+
22+
WORKDIR /opt/oid4vc-demo/${PACKAGE_PATH}
23+
ENTRYPOINT npm run-script ${NODE_SCRIPT}

docker/Dockerfile.oid4vci-demo-frontend

Lines changed: 0 additions & 11 deletions
This file was deleted.

docker/Dockerfile.oid4vp-demo-frontend

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)