-
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.
- Loading branch information
Showing
4 changed files
with
82 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- id: prep | ||
name: find version | ||
shell: bash | ||
run: | | ||
version=$(jq -r '.version' package.json) | ||
echo "Found version: $version" | ||
echo "version=$version" >> $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GHCR (GitHub Packages) | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: | | ||
ghcr.io/${{github.repository}}:latest | ||
ghcr.io/${{github.repository}}:${{steps.prep.outputs.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,16 @@ | ||
FROM node:20-alpine | ||
|
||
RUN apk add --no-cache bash tini | ||
|
||
EXPOSE 3000 | ||
|
||
ENV CRANLIKE_MONGODB_SERVER="mongo" \ | ||
VCAP_APP_HOST="0.0.0.0" | ||
|
||
COPY . /frontend | ||
|
||
WORKDIR /frontend | ||
|
||
RUN npm install . | ||
|
||
ENTRYPOINT [ "tini", "--", "/frontend/entrypoint.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,22 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
function wait_tcp_port { | ||
local host="$1" port="$2" | ||
local max_tries=5 tries=1 | ||
|
||
# see http://tldp.org/LDP/abs/html/devref1.html for description of this syntax. | ||
while ! exec 6<>/dev/tcp/$host/$port && [[ $tries -lt $max_tries ]]; do | ||
sleep 1s | ||
tries=$(( tries + 1 )) | ||
echo "$(date) retrying to connect to $host:$port ($tries/$max_tries)" | ||
done | ||
exec 6>&- | ||
} | ||
|
||
# wait for the mongo server to be available | ||
echo Waiting for ${CRANLIKE_MONGODB_SERVER}:${CRANLIKE_MONGODB_PORT:-27017}... | ||
wait_tcp_port "${CRANLIKE_MONGODB_SERVER}" "${CRANLIKE_MONGODB_PORT:-27017}" | ||
|
||
# run mongo-express | ||
exec npm start |
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