mirror of
https://github.com/Hopiu/lychee.git
synced 2026-03-16 20:50:25 +00:00
Alpine Docker Image Support (#1074)
This commit is contained in:
parent
6a356bf87d
commit
7a35a655d2
4 changed files with 105 additions and 17 deletions
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
|
|
@ -5,3 +5,9 @@ updates:
|
|||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
|
|
|
|||
43
.github/workflows/docker.yml
vendored
43
.github/workflows/docker.yml
vendored
|
|
@ -19,20 +19,21 @@ env:
|
|||
IMAGE_NAME: lycheeverse/lychee
|
||||
DOCKER_PLATFORMS: linux/amd64,linux/arm64/v8
|
||||
DOCKERFILE: Dockerfile-CI.Dockerfile
|
||||
DOCKERFILE_ALPINE: Dockerfile-CI.alpine.Dockerfile
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'lycheeverse' &&
|
||||
github.actor != 'dependabot[bot]' &&
|
||||
github.actor != 'dependabot[bot]' &&
|
||||
( github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login )
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Docker meta
|
||||
- name: Docker meta (debian)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
# list of Docker images to use as base name for tags
|
||||
images: |
|
||||
|
|
@ -49,6 +50,28 @@ jobs:
|
|||
# set latest tag for default branch
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Docker meta (alpine)
|
||||
id: meta-alpine
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
# A global suffix for each generated tag
|
||||
flavor: |
|
||||
suffix=-alpine
|
||||
# list of Docker images to use as base name for tags
|
||||
images: |
|
||||
${{ env.IMAGE_NAME }}
|
||||
# generate Docker tags based on the following events/attributes
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
# set latest tag for default branch
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
|
|
@ -61,8 +84,8 @@ jobs:
|
|||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Push Image
|
||||
uses: docker/build-push-action@v3
|
||||
- name: Push Image (debian)
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ${{ env.DOCKERFILE }}
|
||||
|
|
@ -71,6 +94,16 @@ jobs:
|
|||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Push Image (alpine)
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ${{ env.DOCKERFILE_ALPINE }}
|
||||
platforms: ${{ env.DOCKER_PLATFORMS }}
|
||||
push: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
|
||||
tags: ${{ steps.meta-alpine.outputs.tags }}
|
||||
labels: ${{ steps.meta-alpine.outputs.labels }}
|
||||
|
||||
- name: Update DockerHub description
|
||||
uses: peter-evans/dockerhub-description@v3
|
||||
with:
|
||||
|
|
|
|||
28
Dockerfile-CI.alpine.Dockerfile
Normal file
28
Dockerfile-CI.alpine.Dockerfile
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
FROM alpine:latest as builder
|
||||
WORKDIR /builder
|
||||
|
||||
RUN apk update \
|
||||
&& apk add --no-cache ca-certificates jq wget \
|
||||
&& case $(arch) in \
|
||||
"x86_64") \
|
||||
wget -4 -q -O - "$(wget -4 -q -O- https://api.github.com/repos/lycheeverse/lychee/releases/latest \
|
||||
| jq -r '.assets[].browser_download_url' \
|
||||
| grep x86_64-unknown-linux-musl)" | tar -xz lychee \
|
||||
;; \
|
||||
"aarch64") \
|
||||
wget -4 -q -O - "$(wget -4 -q -O- https://api.github.com/repos/lycheeverse/lychee/releases/latest \
|
||||
| jq -r '.assets[].browser_download_url' \
|
||||
| grep arm-unknown-linux-musleabihf)" | tar -xz lychee \
|
||||
;; \
|
||||
esac \
|
||||
&& chmod +x lychee
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk add --no-cache ca-certificates tzdata \
|
||||
&& addgroup -S lychee \
|
||||
&& adduser -D -G lychee -S lychee
|
||||
|
||||
COPY --from=builder /builder/lychee /usr/local/bin/lychee
|
||||
# Run as non-root user
|
||||
USER lychee
|
||||
ENTRYPOINT [ "/usr/local/bin/lychee" ]
|
||||
45
README.md
45
README.md
|
|
@ -89,7 +89,7 @@ This comparison is made on a best-effort basis. Please create a PR to fix
|
|||
outdated information.
|
||||
|
||||
| | lychee | [awesome_bot] | [muffet] | [broken-link-checker] | [linkinator] | [linkchecker] | [markdown-link-check] | [fink] |
|
||||
| -------------------- | ------- | ------------- | -------- | --------------------- | ------------ | -------------------- | --------------------- | ------ |
|
||||
|----------------------|---------|---------------|----------|-----------------------|--------------|----------------------|-----------------------|--------|
|
||||
| Language | Rust | Ruby | Go | JS | TypeScript | Python | JS | PHP |
|
||||
| Async/Parallel | ![yes] | ![yes] | ![yes] | ![yes] | ![yes] | ![yes] | ![yes] | ![yes] |
|
||||
| JSON output | ![yes] | ![no] | ![yes] | ![yes] | ![yes] | ![maybe]<sup>1</sup> | ![yes] | ![yes] |
|
||||
|
|
@ -188,28 +188,49 @@ but in case you need dedicated support for a new file format, please consider cr
|
|||
### Docker Usage
|
||||
|
||||
Here's how to mount a local directory into the container and check some input
|
||||
with lychee. The `--init` parameter is passed so that lychee can be stopped
|
||||
from the terminal. We also pass `-it` to start an interactive terminal, which
|
||||
is required to show the progress bar.
|
||||
with lychee.
|
||||
|
||||
- The `--init` parameter is passed so that lychee can be stopped from the terminal.
|
||||
- We also pass `-it` to start an interactive terminal, which is required to show the progress bar.
|
||||
- The `--rm` removes not used anymore container from the host after the run (self-cleanup).
|
||||
- The `-w /input` points to `/input` as the default workspace
|
||||
- The `-v $(pwd):/input` does local volume mounting to the container for lychee access.
|
||||
|
||||
> By default a Debian-based Docker image is used. If you want to run an Alpine-based image, use the `latest-alpine` tag.
|
||||
> For example, `lycheeverse/lychee:latest-alpine`
|
||||
|
||||
#### Linux/macOS shell command
|
||||
|
||||
```sh
|
||||
docker run --init -it -v `pwd`:/input lycheeverse/lychee /input/README.md
|
||||
docker run --init -it --rm -w /input -v $(pwd):/input lycheeverse/lychee README.md
|
||||
```
|
||||
|
||||
#### Windows PowerShell command
|
||||
|
||||
```powershell
|
||||
docker run --init -it --rm -w /input -v ${PWD}:/input lycheeverse/lychee README.md
|
||||
```
|
||||
|
||||
### GitHub Token
|
||||
|
||||
To avoid getting rate-limited while checking GitHub links, you can optionally
|
||||
set an environment variable with your Github token like so `GITHUB_TOKEN=xxxx`,
|
||||
set an environment variable with your GitHub token like so `GITHUB_TOKEN=xxxx`,
|
||||
or use the `--github-token` CLI option. It can also be set in the config file.
|
||||
[Here is an example config file][config file].
|
||||
|
||||
The token can be generated in your
|
||||
[GitHub account settings page](https://github.com/settings/tokens). A personal
|
||||
token with no extra permissions is enough to be able to check public repos links.
|
||||
The token can be generated on your [GitHub account settings page](https://github.com/settings/tokens).
|
||||
A personal access token with no extra permissions is enough to be able to check public repo links.
|
||||
|
||||
For more scalable organization-wide scenarios you can consider a [GitHub App][github-app-overview].
|
||||
It has a higher rate limit than personal access tokens but requires additional configuration steps on your GitHub workflow.
|
||||
Please follow the [GitHub App Setup][github-app-setup] example.
|
||||
|
||||
[github-app-overview]: https://docs.github.com/en/apps/overview
|
||||
[github-app-setup]: https://github.com/github/combine-prs/blob/main/docs/github-app-setup.md#github-app-setup
|
||||
|
||||
### Commandline Parameters
|
||||
|
||||
There is an extensive list of commandline parameters to customize the behavior.
|
||||
There is an extensive list of command line parameters to customize the behavior.
|
||||
See below for a full list.
|
||||
|
||||
```text
|
||||
|
|
@ -472,7 +493,7 @@ which includes usage instructions.
|
|||
## Contributing to lychee
|
||||
|
||||
We'd be thankful for any contribution. \
|
||||
We try to keep the issue-tracker up-to-date so you can quickly find a task to work on.
|
||||
We try to keep the issue tracker up-to-date so you can quickly find a task to work on.
|
||||
|
||||
Try one of these links to get started:
|
||||
|
||||
|
|
@ -532,7 +553,7 @@ If you are using lychee for your project, **please add it here**.
|
|||
## Credits
|
||||
|
||||
The first prototype of lychee was built in [episode 10 of Hello
|
||||
Rust](https://hello-rust.show/10/). Thanks to all Github- and Patreon sponsors
|
||||
Rust](https://hello-rust.show/10/). Thanks to all GitHub and Patreon sponsors
|
||||
for supporting the development since the beginning. Also, thanks to all the
|
||||
great contributors who have since made this project more mature.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue