Skip to content

Commit

Permalink
ci: build and push data server image (#362)
Browse files Browse the repository at this point in the history
Example build:
https://github.com/hasura/ndc-hub/actions/runs/11504635181/job/32024555973

Example image:
https://github.com/hasura/ndc-hub/pkgs/container/ndc-hub/294770878?tag=data-server.2704da13c6dfe54b7b50a1f2b9cafecf343bab58

Try running 

```
docker run --rm -it -p 7070:80 ghcr.io/hasura/ndc-hub:data-server.2704da13c6dfe54b7b50a1f2b9cafecf343bab58
```

and visit localhost:7070 to check out the files
  • Loading branch information
scriptnull authored Oct 29, 2024
1 parent 6334ad1 commit 5d7782c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/ddn-assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches:
- "main"

env:
DATA_TAG: data.${{ github.sha }}
DATA_SERVER_TAG: data-server.${{ github.sha }}
DDN_ASSETS_VERSION: v0.1.0

jobs:
generate:
runs-on: ubuntu-latest
Expand All @@ -24,14 +29,14 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate data and push image
- name: Build and push data image
run: |
export NDC_HUB_GIT_REPO_FILE_PATH=$PWD
echo "NDC_HUB_GIT_REPO_FILE_PATH = $NDC_HUB_GIT_REPO_FILE_PATH"
pushd docker/data
echo "Downloading ddn-assets"
wget https://github.com/hasura/ddn-assets/releases/download/v0.1.0/ddn-assets
wget https://github.com/hasura/ddn-assets/releases/download/$DDN_ASSETS_VERSION/ddn-assets
chmod +x ddn-assets
# TODO: get rid of this after fixing https://github.com/hasura/ddn-assets/issues/7
Expand All @@ -40,5 +45,11 @@ jobs:
echo "Running ddn-assets"
./ddn-assets generate
docker build -t ghcr.io/hasura/ndc-hub:data.$GITHUB_SHA . --push
docker build -t ghcr.io/hasura/ndc-hub:$DATA_TAG . --push
popd
- name: Build and push data server image
run: |
pushd docker/server
docker build --build-arg DATA_TAG=$DATA_TAG -t ghcr.io/hasura/ndc-hub:$DATA_SERVER_TAG . --push
popd
3 changes: 3 additions & 0 deletions docker/server/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
localhost

file_server
11 changes: 11 additions & 0 deletions docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG DATA_TAG

FROM ghcr.io/hasura/ndc-hub:$DATA_TAG as data

FROM caddy:alpine

COPY --from=data /assets /srv

EXPOSE 80

CMD ["caddy", "file-server", "--browse", "--root", "/srv"]

0 comments on commit 5d7782c

Please sign in to comment.