Skip to content
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
41 changes: 41 additions & 0 deletions .github/workflows/docker-build-publish-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and publish Docker image for @letterbox/client
on:
# Trigger the workflow on push or pull request,
# for the develop branch and all new tags
push:
branches:
- main
paths:
- "code/client/**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare environment variables
run: |
echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
echo "GIT_LAST_COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y%m%d)" >> $GITHUB_ENV
echo "GIT_BRANCH=$(echo ${GITHUB_REF} | sed 's/refs\/heads\///')" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$(git rev-parse --short ${GITHUB_SHA})" >> $GITHUB_ENV

- name: Build and publish Docker image
uses: elgohr/Publish-Docker-Github-Action@v5
env:
BUILD_DATE: ${{ env.BUILD_DATE }}
GIT_TAG: "latest"
GIT_BRANCH: ${{ env.GIT_BRANCH }}
GIT_COMMIT_SHA: ${{ env.GIT_COMMIT_SHA }}
GIT_LAST_COMMIT_DATE: ${{ env.GIT_LAST_COMMIT_DATE }}
with:
name: c2dhunilu/letterbox-client
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
buildoptions: "--compress --force-rm"
buildargs: |
GIT_TAG,GIT_BRANCH,GIT_COMMIT_SHA,BUILD_DATE,GIT_LAST_COMMIT_DATE
tags: "latest"
workdir: docker/c2dhunilu
context: ../../.
dockerfile: Dockerfile.client
41 changes: 41 additions & 0 deletions .github/workflows/docker-build-publish-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and publish Docker image for @letterbox/server
on:
# Trigger the workflow on push or pull request,
# for the develop branch and all new tags
push:
branches:
- main
paths:
- "code/server/**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare environment variables
run: |
echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
echo "GIT_LAST_COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y%m%d)" >> $GITHUB_ENV
echo "GIT_BRANCH=$(echo ${GITHUB_REF} | sed 's/refs\/heads\///')" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$(git rev-parse --short ${GITHUB_SHA})" >> $GITHUB_ENV

- name: Build and publish Docker image
uses: elgohr/Publish-Docker-Github-Action@v5
env:
BUILD_DATE: ${{ env.BUILD_DATE }}
GIT_TAG: "latest"
GIT_BRANCH: ${{ env.GIT_BRANCH }}
GIT_COMMIT_SHA: ${{ env.GIT_COMMIT_SHA }}
GIT_LAST_COMMIT_DATE: ${{ env.GIT_LAST_COMMIT_DATE }}
with:
name: c2dhunilu/letterbox-server
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
buildoptions: "--compress --force-rm"
buildargs: |
GIT_TAG,GIT_BRANCH,GIT_COMMIT_SHA,BUILD_DATE,GIT_LAST_COMMIT_DATE
tags: "latest"
workdir: docker/c2dhunilu
context: ../../.
dockerfile: Dockerfile.server
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ tsconfig.tsbuildinfo
**/__screenshots__
# Sentry Config File
.env.sentry-build-plugin
*.tsbuildinfo
docker/c2dhunilu/.env
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,36 @@ If you change the GraphQL schema on the server, you need to update the types on
cd code/client
npm run generate
```

## Docker Images for C2DH

Docker images for both client and server are built and published to Docker Hub via GitHub Actions, availble as [c2dhunilu/letterbox-client](https://hub.docker.com/r/c2dhunilu/letterbox-client) and [c2dhunilu/letterbox-server](https://hub.docker.com/r/c2dhunilu/letterbox-server).
You can build it locally using Makefile:

```bash
cd docker/c2dhunilu
make build-client
make build-server
```

The actions `.github/workflows/docker-build-publish-client.yml` and `.github/workflows/docker-build-publish-server.yml` contain the workflow to build and publish the images automatically on each push related to `code/client` or `code/server` content to the main branch.
Note that the client docker image, whose code source is located in `code/client`, consists only of static files (HTML, CSS, JS).

the folder `docker/c2dhunilu` contains a `docker-compose.yml` file that allows deployment of an instance of Letterbox. Create a `.env`file with the following:

```bash
ELASTICSEARCH_JVM_OPTS=-Xms512m -Xmx512m
ELASTICSEARCH_MAX_PARALLEL_UPDATE=2
NEO4J_LOGIN=************
NEO4J_PASSWORD=*******
NEO4J_HEAP=512m
NEO4J_PAGECACHE=512m
```

Add the csv data as specified above, then run the import using the script included in the server image:

```bash
docker exec -it c2dhunilu-server-1 /bin/sh
cd bin
node dataset-import.js
```
Loading