Skip to content

Commit

Permalink
Docker: migrate from hub.docker.com to ghcr.io
Browse files Browse the repository at this point in the history
Docker, Inc. has become hostile to OSS development.
  • Loading branch information
dmke committed Mar 16, 2023
1 parent 9fde87e commit c17f6d9
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM debian:bullseye-slim

# This Dockerfile is used by GitHub Actions to build the
# digineode/texd:base image on a regular basis.
# ghcr.io/digineo/texd:base image on a regular basis.
#
# It leverages buildkit to generate an AMD64 and ARM64 image.
#
Expand Down
6 changes: 3 additions & 3 deletions .github/Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ ARG IS_RELEASE=0
FROM golang:${GO_VERSION}-bullseye as builder

# This Dockerfile is used by GitHub Actions to build the
# digineode/texd:latest image whenever there is a commit pushed
# ghcr.io/digineo/texd:latest image whenever there is a commit pushed
# to the master branch. For tagged commits, this also creates
# digineode/texd:vX and digineode/texd:vX.Y.Z.
# ghcr.io/digineo/texd:vX and ghcr.io/digineo/texd:vX.Y.Z.
#
# It leverages buildkit to generate an AMD64 and ARM64 image.
#
Expand All @@ -28,7 +28,7 @@ RUN <<-eot
./texd --version
eot

FROM digineode/texd:base
FROM ghcr.io/digineo/texd:base

COPY --from=builder /work/texd /bin/

Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -38,5 +39,5 @@ jobs:
file: ./.github/Dockerfile.base
platforms: linux/amd64,linux/arm64/v8
push: true
tags: digineode/texd:base
tags: ghcr.io/digineo/texd:base
context: .
12 changes: 8 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,20 @@ jobs:
docker:
name: Build Docker images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Login to Docker Hub
- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -66,7 +70,7 @@ jobs:
uses: docker/metadata-action@v4
id: meta
with:
images: digineode/texd
images: ghcr.io/digineo/texd
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM digineode/texd:base
FROM ghcr.io/digineo/texd:base

COPY texd /bin/

Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ run-local: tmp build ## builds and runs texd in local mode

.PHONY: run-container
run-container: tmp build ## builds and runs texd in container mode
./$(TARGET) $(RUN_ARGS) $(EXTRA_RUN_ARGS) digineode/texd:base
./$(TARGET) $(RUN_ARGS) $(EXTRA_RUN_ARGS) ghcr.io/digineo/texd:base

.PHONY: run-dind-bind
run-dind-bind: tmp docker-latest ## build and runs texd in container mode, using Docker-in-Docker
Expand All @@ -59,9 +59,9 @@ run-dind-bind: tmp docker-latest ## build and runs texd in container mode, using
-v /var/run/docker.sock:/var/run/docker.sock \
-v $$(pwd)/tmp:/texd \
-p 127.0.0.1:2201:2201 \
digineode/texd:latest \
ghcr.io/digineo/texd:latest \
--log-level debug $(EXTRA_RUN_ARGS) \
digineode/texd:base
ghcr.io/digineo/texd:base

.PHONY: run-dind-volume
run-dind-volume: tmp docker-latest ## build and runs texd in container mode, using Docker-in-Docker
Expand All @@ -70,9 +70,9 @@ run-dind-volume: tmp docker-latest ## build and runs texd in container mode, usi
-v /var/run/docker.sock:/var/run/docker.sock \
-v texd-work:/texd \
-p 127.0.0.1:2201:2201 \
digineode/texd:latest \
ghcr.io/digineo/texd:latest \
--log-level debug $(EXTRA_RUN_ARGS) \
digineode/texd:base
ghcr.io/digineo/texd:base

## testing

Expand Down Expand Up @@ -129,7 +129,7 @@ docker-latest: build ## builds a Docker container with the latest binary
--label=org.opencontainers.image.title=$(TARGET) \
--label=org.opencontainers.image.revision=$(shell git show -s --format=%H HEAD) \
--label=org.opencontainers.image.version=$(VERSION) \
-t digineode/texd:latest \
-t ghcr.io/digineo/texd:latest \
.

.PHONY: bump bump-major bump-minor bump-patch
Expand Down
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ $ texd
### Ephemeral Containers

Here, you still download and run texd locally, but document rendering will happen in an short-lived
Docker container, using a specific Docker image (`texlive/texlive:latest` will do just fine, but you
could easily build a smaller one using e.g. a Debian base image).
Docker container, using a specific Docker image (`registry.gitlab.com/islandoftex/images/texlive:latest`
will do just fine, but you could easily build a smaller one using e.g. a Debian base image).

To run in container mode, run:

```console
$ texd texlive/texlive:latest
$ texd registry.gitlab.com/islandoftex/images/texlive:latest
```

This will pull the specified image, if it doesn't exist yet. Note that you need to give texd
Expand All @@ -63,7 +63,7 @@ this case, the first image is used as default image:

```console
$ texd \
texlive/texlive:latest \
registry.gitlab.com/islandoftex/images/texlive:latest \
registry.gitlab.com/islandoftex/images/texlive:TL2014-historic \
ghcr.io/yourcompany/texlive-prod
```
Expand All @@ -77,14 +77,25 @@ viable alternative to the local mode. In fact, this mode is functionally equival
To run texd as Docker service, use this command:

```console
$ docker run --rm -t -p localhost:2201:2201 digineode/texd:latest
$ docker run --rm -t -p localhost:2201:2201 ghcr.io/digineo/texd:latest
```

When using Gitlab CI, you can add this line to your `.gitlab-ci.yml`:
The image `ghcr.io/digineo/texd:latest` is based on Debian Bullseye with
some texlive packages installed from the Debian repositories (see this
[`Dockerfile`](./.github/Dockerfile.base) for the current list). Note
that Debian Bullseye comes with [TeXlive 2020][], while (at the time of
writing) the current release is TeXlive 2022.

> **Note:**
>
> An earlier version of this README made use of `digineode/texd` instead
> of `ghcr.io/digineo/texd:latest`.
When using Gitlab CI, you can add this snippet to your `.gitlab-ci.yml`:

```yml
services:
- name: digineode/texd:latest
- name: ghcr.io/digineo/texd:latest
alias: texd

variables:
Expand All @@ -93,16 +104,16 @@ variables:
TEXD_ENDPOINT: http://texd:2201/render
```
This image is based on `texlive/texlive:latest`.
[TeXlive 2020]: https://packages.debian.org/bullseye/texlive
## CLI Options
Calling texd with options works in any mode; these commands are equivalent:
```console
$ texd -h
$ texd texlive/texlive:latest -h
$ docker run --rm -t digineode/texd:latest -h
$ texd tregistry.gitlab.com/islandoftex/images/texlive:latestest -h
$ docker run --rm -t ghcr.io/digineo/texd:latest -h
```

- `--help`, `-h`
Expand Down Expand Up @@ -371,7 +382,7 @@ Content-Length: 287
{
"version": "0.0.0",
"mode": "container",
"images": ["texlive/texlive:latest"],
"images": ["registry.gitlab.com/islandoftex/images/texlive:latest"],
"timeout": 60,
"engines": ["xelatex","pdflatex","lualatex"],
"default_engine": "xelatex",
Expand Down
6 changes: 3 additions & 3 deletions exec/docker_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ func (s *dockerClientSuite) TestNewDockerClient() {
func (s *dockerClientSuite) TestFindAllowedImageID() {
s.subject.images = []types.ImageSummary{
{ID: "a", RepoTags: []string{"localhost/texd/minimal:v1", "localhost/texd/minimal:latest"}},
{ID: "b", RepoTags: []string{"texlive/texlive:latest"}},
{ID: "b", RepoTags: []string{"registry.gitlab.com/islandoftex/images/texlive:latest"}},
}

s.Assert().Equal("a", s.subject.findAllowedImageID("localhost/texd/minimal:latest"))
s.Assert().Equal("b", s.subject.findAllowedImageID("texlive/texlive:latest"))
s.Assert().Equal("b", s.subject.findAllowedImageID("registry.gitlab.com/islandoftex/images/texlive:latest"))
s.Assert().Equal("", s.subject.findAllowedImageID("unknown"))
}

func (s *dockerClientSuite) TestFindAllowedImageID_empty() {
s.Assert().Equal("", s.subject.findAllowedImageID("texlive/texlive:latest"))
s.Assert().Equal("", s.subject.findAllowedImageID("registry.gitlab.com/islandoftex/images/texlive:latest"))
}

func (s *dockerClientSuite) TestFindAllowedImageID_default() {
Expand Down
2 changes: 1 addition & 1 deletion testdata/integration/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
texd:
image: digineode/texd:latest
image: ghcr.io/digineo/texd:latest
command: --reference-store=memcached://memcached:11211?expiration=5s
depends_on:
- memcached
Expand Down

0 comments on commit c17f6d9

Please sign in to comment.