forked from hyperledger-cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes hyperledger-cacti#3284 Signed-off-by: raynato.c.pedrajeta <raynato.c.pedrajeta@accenture.com>
- Loading branch information
1 parent
c7fce88
commit 601d444
Showing
5 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM ubuntu:22.04 | ||
|
||
RUN apt update | ||
RUN apt install curl openjdk-21-jdk -y | ||
RUN curl -sSL https://get.daml.com/ | sh | ||
ENV PATH="/root/.daml/bin:${PATH}" | ||
RUN daml new create-daml-app --template create-daml-app | ||
WORKDIR /create-daml-app | ||
|
||
CMD ["daml", "start"] | ||
|
||
COPY healthcheck.sh /healthcheck.sh | ||
RUN chmod +x /healthcheck.sh | ||
|
||
HEALTHCHECK --interval=30s --timeout=60s --start-period=100s --retries=100 CMD /healthcheck.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# DAML Example - Sample DAML App | ||
|
||
## Usage | ||
|
||
## Building and running the container locally | ||
|
||
# Run the built image with ports mapped to the host machine as you see fit | ||
1. On the file, locate the docker-all-in-one folder via this command: `cd tools/docker/daml-all-in-one` | ||
2. Build the docker image using this: | ||
docker build -t daml-all-in-one . | ||
3. Run the docker image: | ||
docker run --privileged -p 6865:6865 -p 7575:7575 daml-all-in-one | ||
4. Observe the logs and check for this status to confirm that DAML has successfully started: | ||
`[http-json-ledger-api-pekko.actor.default-dispatcher-12] INFO com.daml.http.Endpoints - Responding to client with HTTP 200 OK,` | ||
5. For healthcheck, check the query for DAML contract on docker logs: | ||
`" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 26 0 26 0 0 24 0 --:--:-- 0:00:01 --:--:-- 24\r100 26 0 26 0 0 24 0 --:--:-- 0:00:01 --:--:-- 24\n{\"result\":[],\"status\":200}DAML API Success!\n"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: quorum-all-in-one-publish | ||
|
||
on: | ||
# Publish `v1.2.3` tags as releases. | ||
push: | ||
tags: | ||
- v* | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
IMAGE_NAME: cactus-quorum-all-in-one | ||
|
||
jobs: | ||
# Push image to GitHub Packages. | ||
# See also https://docs.docker.com/docker-hub/builds/ | ||
build-tag-push-container: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
DOCKERFILE_PATH: ./tools/docker/daml-all-in-one/Dockerfile | ||
DOCKER_BUILD_DIR: ./tools/docker/daml-all-in-one/ | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4.1.1 | ||
|
||
- name: Build image | ||
run: docker build "$DOCKER_BUILD_DIR" --file "$DOCKERFILE_PATH" --tag "$IMAGE_NAME" --label "runnumber=${GITHUB_RUN_ID}" | ||
|
||
- name: Log in to registry | ||
# This is where you will update the PAT to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Push image | ||
run: | | ||
SHORTHASH=$(git rev-parse --short "$GITHUB_SHA") | ||
TODAYS_DATE="$(date +%F)" | ||
DOCKER_TAG="$TODAYS_DATE-$SHORTHASH" | ||
IMAGE_ID="ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME" | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo "$IMAGE_ID" | tr '[:upper:]' '[:lower:]') | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/*" ]] && VERSION="${VERSION//^v//}" | ||
# Do not use the `latest` tag at all, tag with date + git short hash if there is no git tag | ||
[ "$VERSION" == "main" ] && VERSION=$DOCKER_TAG | ||
echo IMAGE_ID="$IMAGE_ID" | ||
echo VERSION="$VERSION" | ||
docker tag "$IMAGE_NAME" "$IMAGE_ID:$VERSION" | ||
docker push "$IMAGE_ID:$VERSION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# docker exec -it eb40b692a662 /bin/bash | ||
|
||
curl -X GET http://localhost:7575/v1/query -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJzYW5kYm94IiwiYXBwbGljYXRpb25JZCI6ImZvb2JhciIsImFjdEFzIjpbIkFsaWNlIl19fQ.1Y9BBFH5uVz1Nhfmx12G_ECJVcMncwm-XLaWM40EHbY" | ||
|
||
echo "DAML API Success!" |