Skip to content

Commit 330f94d

Browse files
committed
ubuntu-22.04, all dev deps in the container
1 parent 4b5c040 commit 330f94d

File tree

5 files changed

+138
-9
lines changed

5 files changed

+138
-9
lines changed

.github/workflows/dev.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This is the temporary workflow for building and pushing imgproxy-base images with v4-dev tag.
2+
name: Build dev image
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
tag:
8+
description: "The tag to push the image with"
9+
required: true
10+
default: "v4-dev"
11+
12+
concurrency:
13+
group: build-v4-dev-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
BASE_IMAGE_NAME: ghcr.io/imgproxy/imgproxy-base
18+
19+
jobs:
20+
build:
21+
if: github.repository_owner == 'imgproxy'
22+
strategy:
23+
matrix:
24+
build:
25+
- arch: amd64
26+
dockerPlatform: linux/amd64
27+
image: linux-5.0
28+
- arch: arm64
29+
dockerPlatform: linux/arm64/v8
30+
image: arm-3.0
31+
runs-on:
32+
- codebuild-imgproxy-${{ github.run_id }}-${{ github.run_attempt }}
33+
- image:${{ matrix.build.image }}
34+
permissions:
35+
contents: read
36+
packages: write
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Login to GitHub Container Registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Build and push
49+
uses: docker/build-push-action@v6
50+
with:
51+
tags: ${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.tag }}-${{ matrix.build.arch }}
52+
platforms: ${{ matrix.build.dockerPlatform }}
53+
provenance: false
54+
push: true
55+
56+
push_manifests:
57+
needs: build
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
61+
packages: write
62+
steps:
63+
- name: Login to GitHub Container Registry
64+
uses: docker/login-action@v3
65+
with:
66+
registry: ghcr.io
67+
username: ${{ github.actor }}
68+
password: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Push manifests
71+
run: |
72+
docker buildx imagetools create -t ${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.tag }} ${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.tag }}-amd64 ${{ env.BASE_IMAGE_NAME }}:${{ github.event.inputs.tag }}-arm64

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"[dockerfile]": {
3+
"editor.formatOnSave": false,
4+
"editor.defaultFormatter": null
5+
}
6+
}

Dockerfile

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# Use Debian Bullseye as a base image to link against glibc 2.31.
2-
FROM public.ecr.aws/debian/debian:bullseye-slim AS base
1+
# Base image for building imgproxy and its dependencies.
2+
ARG BASE_IMAGE=public.ecr.aws/ubuntu/ubuntu:22.04
3+
4+
# Use ubuntu 22.04 as a base image to link against glibc 2.35.
5+
FROM ${BASE_IMAGE} AS base
36

47
RUN apt-get update \
58
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -10,7 +13,11 @@ RUN apt-get update \
1013
build-essential \
1114
pkg-config \
1215
libssl-dev \
13-
libstdc++-10-dev
16+
libstdc++-10-dev \
17+
&& apt-get clean \
18+
&& truncate -s 0 /var/log/*log \
19+
&& rm -rf /tmp/* \
20+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1421

1522
WORKDIR /root
1623

@@ -27,7 +34,8 @@ FROM base AS deps
2734

2835
COPY install-rust.sh ./
2936

30-
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
37+
RUN apt-get update \
38+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
3139
autoconf \
3240
autopoint \
3341
automake \
@@ -40,7 +48,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
4048
gperf \
4149
&& ./install-rust.sh \
4250
&& python3 -m venv /root/.python \
43-
&& /root/.python/bin/pip install meson ninja packaging
51+
&& /root/.python/bin/pip install meson ninja packaging \
52+
&& apt-get clean \
53+
&& truncate -s 0 /var/log/*log \
54+
&& rm -rf /tmp/* \
55+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
4456

4557
COPY versions.sh build-deps.sh build-bash-profile.sh *.patch ./
4658
COPY --from=deps-src /root/deps /root/deps
@@ -61,24 +73,52 @@ RUN ./install-go.sh
6173

6274
# ==============================================================================
6375

64-
FROM public.ecr.aws/debian/debian:bullseye-slim AS final
76+
FROM ${BASE_IMAGE} AS final
6577
LABEL maintainer="Sergey Alexandrovich <[email protected]>"
6678

6779
RUN apt-get update \
6880
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
6981
bash \
7082
curl \
71-
git \
7283
ca-certificates \
7384
build-essential \
7485
pkg-config \
7586
libssl-dev \
76-
libstdc++-10-dev
87+
libstdc++-10-dev \
88+
software-properties-common \
89+
gpg-agent \
90+
&& apt-get clean \
91+
&& truncate -s 0 /var/log/*log \
92+
&& rm -rf /tmp/* \
93+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
94+
95+
# Install LLVM 20 (for clang-format) and latest git (custom, newer versions)
96+
RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" > /etc/apt/sources.list.d/llvm20.list \
97+
&& curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
98+
99+
RUN apt-add-repository ppa:git-core/ppa
100+
101+
RUN apt-get update \
102+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
103+
git \
104+
clang-format \
105+
&& apt-get clean \
106+
&& truncate -s 0 /var/log/*log \
107+
&& rm -rf /tmp/* \
108+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
77109

78110
WORKDIR /root
79111

80112
COPY --from=golang /usr/local/go /usr/local/go
81-
ENV PATH=$PATH:/usr/local/go/bin
113+
ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin
114+
115+
RUN go install github.com/golangci/golangci-lint/v2/cmd/[email protected] \
116+
&& go install github.com/evilmartians/lefthook@latest \
117+
&& go install gotest.tools/gotestsum@latest \
118+
&& go install github.com/air-verse/air@latest \
119+
&& go clean -cache -modcache
120+
121+
COPY --from=deps /root/deps/lychee/lychee /usr/local/bin/lychee
82122

83123
COPY --from=deps /opt/imgproxy/lib /opt/imgproxy/lib
84124
COPY --from=deps /opt/imgproxy/include /opt/imgproxy/include
@@ -87,5 +127,7 @@ COPY --from=deps /opt/imgproxy/bin /opt/imgproxy/bin
87127
COPY --from=deps /root/.bashrc /root/.bashrc
88128
ENV BASH_ENV=/root/.bashrc
89129

130+
ENV IMGPROXY_IN_BASE_CONTAINER=true
131+
90132
WORKDIR /app
91133
CMD ["bash"]

download-deps.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,9 @@ mkdir $DEPS_SRC/vips
229229
cd $DEPS_SRC/vips
230230
curl -Ls https://github.com/libvips/libvips/releases/download/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.xz \
231231
| tar -xJC . --strip-components=1
232+
233+
print_download_stage lychee $LYCHEE_VERSION
234+
mkdir $DEPS_SRC/lychee
235+
cd $DEPS_SRC/lychee
236+
curl -L "https://github.com/lycheeverse/lychee/releases/download/lychee-v${LYCHEE_VERSION}/lychee-$(uname -m)-unknown-linux-gnu.tar.gz" \
237+
| tar -xz

versions.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ export FRIBIDI_VERSION=1.0.16
3333
export PANGO_VERSION=1.57.0
3434
export LIBRSVG_VERSION=2.61.1
3535
export VIPS_VERSION=8.17.2
36+
37+
# dev depdendencies
38+
export LYCHEE_VERSION=0.20.1

0 commit comments

Comments
 (0)