Skip to content

Commit

Permalink
Test this website with score-compose
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Benoit <[email protected]>
  • Loading branch information
mathieu-benoit committed Oct 26, 2024
1 parent 03bddf7 commit ef9f013
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@ jobs:
- run: npm install -g yarn
- run: yarn install
- run: yarn run hugo
- run: yarn run dprint check
- run: yarn run dprint check
- uses: score-spec/setup-score@v3
with:
file: score-compose
token: ${{ secrets.GITHUB_TOKEN }}
version: 'latest'
- run: |
score-compose init --no-sample
score-compose generate score.yaml --build main=.
- run: |
docker compose up --build -d
- run: |
curl $(score-compose resources get-outputs dns.default#score-docs.dns --format '{{ .host }}:8080/docs/')
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ package-lock.json
.hugo_build.lock
.cspell/
.vscode/ltex.dictionary.en-US.txt
./static/_pagefind
./static/_pagefind
.score-compose/state.yaml
.score-compose/zz-default.provisioners.yaml
.score-compose/mounts/routing-QXKXWL/nginx.conf
compose.yaml
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# We use golang because hugo depends on Go as it's module downloader
FROM golang:alpine
# We then install shared libs and dynamic linking dependencies
RUN apk add --no-cache gcc g++ musl-dev git yarn gcompat npm

COPY . /src
WORKDIR /src

# Install all the packages
RUN yarn install

# Do an initial hugo build
RUN yarn hugo --verbose

# Run the hugo server at launch
CMD [ "yarn", "hugo", "server", "--themesDir", "../..", "--disableFastRender", "--renderToMemory", "--bind", "0.0.0.0" ]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ For information on Score's style guide see the [Style guide](styles/style-guide.

### Running the website locally

#### `yarn`

We use `yarn` (for MacOS: `brew install yarn`) as a package manager to ensure the versions of Hugo and associated tools are up to date. All commands that execute those tools are prefixed with `yarn run` or are aliased in the `package.json` file.

To install the packages:
Expand All @@ -27,6 +29,18 @@ yarn run hugo server

And then view it at <http://localhost:1313>.

#### `score-compose`

You can [install `score-compose`](https://docs.score.dev/docs/score-implementation/score-compose/installation/) and then build and run this hugo website as a container:
```
score-compose init --no-sample
score-compose generate score.yaml --build main=.
docker compose up --build -d
curl $(score-compose resources get-outputs dns.default#score-docs.dns --format '{{ .host }}:8080/docs/')
```

### Deployment

This site is currently deployed through Github Pages with a CNAME directing `docs.score.dev` to `score-spec.github.io`. The DNS configuration is managed by Humanitec.
Expand Down
20 changes: 20 additions & 0 deletions score.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: score.dev/v1b1
metadata:
name: score-docs
containers:
main:
image: .
resources:
dns:
type: dns
route:
type: route
params:
host: ${resources.dns.host}
path: /
port: 8080
service:
ports:
tcp:
port: 8080
targetPort: 8080

0 comments on commit ef9f013

Please sign in to comment.