Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: extend Docker Support #1142

Open
wants to merge 6 commits into
base: v4
Choose a base branch
from

Conversation

almereyda
Copy link

@almereyda almereyda commented May 16, 2024

These commits package Quartz as a container here at the GitHub container registry when a new tag is pushed:

The CI workflow is prepared to also push to Docker Hub. There is also a workflow dispatch trigger to create manual builds. The configuration could be parametrised more in the future.

The Dockerfile has been minimally modified to conform to the OCI standard with regards to the entrypoint and its command, plus has been extended with the missing git dependency to be able to use the build command.

The documentation has been extended with some examples on how to use the image.

The documentation expects the image to be pushed to ghcr.io/jackyzha0/quartz.

@almereyda
Copy link
Author

An exemplary pipeline run and artifact were generated into:

@almereyda
Copy link
Author

almereyda commented May 16, 2024

This image also supports running in GitLab CI to push into GitLab Pages:

image:
  name: ghcr.io/allmende/quartz:v4
  entrypoint: [""]

pages:
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

  stage: deploy
  environment: live

  before_script:
    - cd /usr/src/app
    - mkdir -p public

  script:
    - cp $CI_PROJECT_DIR/quartz.*.ts .
    - npx quartz build -d $CI_PROJECT_DIR/content
    - mv public $CI_PROJECT_DIR

  artifacts:
    paths:
      - public

The minimal example for the file system layout of a content repository without including a whole fork of Quartz looks like this:

.
├── content
│   └── index.md
├── quartz.config.ts
└── quartz.layout.ts

@bachrc
Copy link
Contributor

bachrc commented May 19, 2024

there seem to be some issues with the linting, you can see the action logs

@almereyda
Copy link
Author

I've pushed a commit to fix the linter issues, which seem to be resolved.

While there is no definition of a content repository for quartz, we have updated our patterns.

.
├── .quartz
│   ├── quartz
│   │   └── components
│   │       ├── Backlinks.tsx
│   │       └── Footer.tsx
│   ├── quartz.config.ts
│   └── quartz.layout.ts
├── content
│   └── index.md
└── .gitlab-ci.yml

The CI needs to be adapted as well:

image:
  name: ghcr.io/allmende/quartz:v4
  entrypoint: [""]

pages:
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

  stage: deploy
  environment: live

  before_script:
    - cd /usr/src/app
    - mkdir -p public

  script:
    - cp -R $CI_PROJECT_DIR/.quartz/* .
    - npx quartz build -d $CI_PROJECT_DIR/content
    - mv public $CI_PROJECT_DIR

  artifacts:
    paths:
      - public

By using the dot pattern for the Quartz configuration, we can cleanly separate the concerns of content and configuration and can still apply a custom overlay, e.g. here also for certain components.

docker build --load -t ghcr.io/jackyzha0/quartz .
```

This example expects a `content/` directory with the `quartz.*.ts` configuration files and a (empty) `public/` directory to be present in the preesent working directory.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you illustrate the working directory structure here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion.

My exemplary way to use this container has also changed a bit, as illustrated in my previous comment. I will update the file.

docs/features/Docker Support.md Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants