Skip to content

Commit 535c6e0

Browse files
committed
Push Docker images to ghcr.io; Update README
1 parent a75e640 commit 535c6e0

2 files changed

Lines changed: 37 additions & 25 deletions

File tree

.github/workflows/build.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
env:
1212
DOCKER_META_IMAGES: |
13-
darthsim/imgproxy-base
13+
ghcr.io/imgproxy/imgproxy-base
1414
DOCKER_META_TAGS: |
1515
type=semver,pattern=v{{version}}
1616
type=ref,event=branch,enable=${{ startsWith(github.ref, 'refs/heads/test/') }}
@@ -29,6 +29,9 @@ jobs:
2929
runs-on:
3030
- codebuild-imgproxy-${{ github.run_id }}-${{ github.run_attempt }}
3131
- image:${{ matrix.build.image }}
32+
permissions:
33+
contents: read
34+
packages: write
3235
steps:
3336
- name: Checkout
3437
uses: actions/checkout@v4
@@ -43,11 +46,12 @@ jobs:
4346
latest=auto
4447
suffix=-${{ matrix.build.arch }},onlatest=true
4548
46-
- name: Login to Docker Hub
49+
- name: Login to GitHub Container Registry
4750
uses: docker/login-action@v3
4851
with:
49-
username: ${{ vars.DOCKERHUB_USERNAME }}
50-
password: ${{ secrets.DOCKERHUB_TOKEN }}
52+
registry: ghcr.io
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
5155

5256
- name: Set up Docker Buildx
5357
uses: docker/setup-buildx-action@v3
@@ -64,6 +68,9 @@ jobs:
6468
push_manifests:
6569
needs: build
6670
runs-on: ubuntu-latest
71+
permissions:
72+
contents: read
73+
packages: write
6774
steps:
6875
- name: Docker meta
6976
id: meta
@@ -74,11 +81,12 @@ jobs:
7481
flavor: |
7582
latest=auto
7683
77-
- name: Login to Docker Hub
84+
- name: Login to GitHub Container Registry
7885
uses: docker/login-action@v3
7986
with:
80-
username: ${{ vars.DOCKERHUB_USERNAME }}
81-
password: ${{ secrets.DOCKERHUB_TOKEN }}
87+
registry: ghcr.io
88+
username: ${{ github.actor }}
89+
password: ${{ secrets.GITHUB_TOKEN }}
8290

8391
- name: Push manifests
8492
run: |

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ docker run --rm -it \
1515
-p 8080:8080 \
1616
-v $(pwd):/app \
1717
--name imgproxy_dev \
18-
darthsim/imgproxy-base:latest
18+
ghcr.io/imgproxy/imgproxy-base:latest
1919
```
2020

2121
...and build your imgproxy as usual:
@@ -29,11 +29,12 @@ go build
2929
If you don't care about the size, you can just build your Docker image on top of this one:
3030

3131
```dockerfile
32-
FROM darthsim/imgproxy-base:latest
32+
FROM ghcr.io/imgproxy/imgproxy-base:latest
3333

3434
COPY . .
3535
# We use bash here to load dynamically generated build environment from /root/.basrc
36-
RUN ["bash", "-c", "go build -v -o /usr/local/bin/imgproxy"]
36+
RUN ["bash", "-c", "go build -v -o /opt/imgproxy/bin/imgproxy"]
37+
RUN ln -s /opt/imgproxy/bin/imgproxy /usr/local/bin/imgproxy
3738

3839
ENV VIPS_WARNING=0
3940
ENV MALLOC_ARENA_MAX=2
@@ -48,40 +49,43 @@ EXPOSE 8080
4849

4950
But you probably want to use multistage build to minimize the final image, and it's a bit tricky. You need to take care of the following:
5051

51-
1. Copy built dependencies from `/usr/local/lib`.
52-
2. Install ca-certificates, libsm6, liblzma5, libzstd1, and libpcre3 from the Debian repo.
53-
3. Set proper libraries paths.
52+
1. Copy built dependencies from `/opt/imgproxy`.
53+
2. Install required system dependencies.
5454

5555
Here is the working example:
5656

5757
```dockerfile
58-
FROM darthsim/imgproxy-base:latest
58+
FROM ghcr.io/imgproxy/imgproxy-base:latest
5959

6060
COPY . .
61-
RUN ["bash", "-c", "go build -v -o /usr/local/bin/imgproxy"]
61+
RUN ["bash", "-c", "go build -v -o /opt/imgproxy/bin/imgproxy"]
62+
63+
# Remove unnecessary files
64+
RUN rm -rf /opt/imgproxy/lib/pkgconfig /opt/imgproxy/lib/cmake
6265

6366
# ==================================================================================================
6467
# Final image
6568

66-
FROM debian:bullseye-slim
69+
FROM public.ecr.aws/ubuntu/ubuntu:noble
6770

6871
RUN apt-get update \
6972
&& apt-get upgrade -y \
70-
&& apt-get install -y --no-install-recommends \
73+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
7174
bash \
7275
ca-certificates \
73-
libsm6 \
74-
liblzma5 \
75-
libzstd1 \
76-
libpcre3 \
77-
&& rm -rf /var/lib/apt/lists/*
76+
libstdc++6 \
77+
fontconfig-config \
78+
fonts-dejavu-core \
79+
media-types \
80+
&& rm -rf /var/lib/apt/lists/* \
81+
&& rm -rf /etc/fonts/conf.d/10-sub-pixel-rgb.conf /etc/fonts/conf.d/11-lcdfilter-default.conf
7882

79-
COPY --from=0 /usr/local/bin/imgproxy /usr/local/bin/
80-
COPY --from=0 /usr/local/lib /usr/local/lib
83+
COPY --from=build /opt/imgproxy/bin/imgproxy /opt/imgproxy/bin/
84+
COPY --from=build /opt/imgproxy/lib /opt/imgproxy/lib
85+
RUN ln -s /opt/imgproxy/bin/imgproxy /usr/local/bin/imgproxy
8186

8287
ENV VIPS_WARNING=0
8388
ENV MALLOC_ARENA_MAX=2
84-
ENV LD_LIBRARY_PATH /usr/local/lib
8589

8690
RUN groupadd -r imgproxy && useradd -r -u 999 -g imgproxy imgproxy
8791
USER 999

0 commit comments

Comments
 (0)