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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git*
.husky
screenshots
Dockerfile
README.md
39 changes: 39 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and test Docker image
on:
pull_request:
branches: [main]
jobs:
docker-build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
target: runtime
load: true
tags: |
recorder
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Test Docker image
shell: bash
run: |
docker run --detach --name recorder recorder

echo "Waiting for container to become healthy..."
STATE="$(docker inspect recorder | jq --raw-output '.[0].State.Health.Status')"
while [[ "$STATE" != "healthy" ]]; do
if [[ "$STATE" != "starting" ]]; then
echo "Container is unhealthy. Healthcheck output:"
docker inspect recorder | jq --raw-output '.[0].State.Health.Log[-1].Output'
exit 1
fi
sleep 5;
echo "Still waiting..."
STATE="$(docker inspect recorder | jq --raw-output '.[0].State.Health.Status')"
done
echo "Container is healthy"
docker stop recorder
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:20-alpine AS build

WORKDIR /app
COPY . .

RUN yarn install --frozen-lockfile
RUN yarn build


FROM nginx:alpine AS runtime

COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

HEALTHCHECK --timeout=5s \
CMD curl --fail --show-headers http://localhost:80/ || exit 1