Skip to content

Commit 4029a20

Browse files
committed
Dockerfile: Migrate to Noble and make it more readable with heredocs, using way less layers and cleaning up apt
1 parent 2ec0571 commit 4029a20

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

Dockerfile

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,49 @@
11
ARG BASE_OS=ubuntu
2-
ARG BASE_CODENAME=jammy
2+
ARG BASE_CODENAME=noble
33
FROM $BASE_OS:$BASE_CODENAME AS build-stage
44

55
# Download build dependencies
6-
RUN apt-get update && apt-get install -y --no-install-recommends \
7-
gcc librsvg2-bin linux-headers-generic python3-dev python3-setuptools
8-
6+
RUN <<EOR
7+
apt-get update
8+
apt-get install -y --no-install-recommends \
9+
gcc \
10+
librsvg2-bin \
11+
linux-headers-generic \
12+
python3-dev \
13+
python3-setuptools \
14+
python-is-python3
15+
apt-get clean && rm -rf /var/lib/apt/lists/*
16+
EOR
917
# Prepare working directory and target
1018
COPY . /work
1119
WORKDIR /work
1220
ARG TARGET=/build/usr
1321

1422
# Build and install
15-
RUN python3 setup.py build --executable "/usr/bin/env python3" && \
16-
python3 setup.py install --single-version-externally-managed --home "${TARGET}" --record /dev/null
23+
RUN <<EOR
24+
python setup.py build --executable "/usr/bin/env python3"
25+
python setup.py install --single-version-externally-managed --home "${TARGET}" --record /dev/null
1726

1827
# Provide input-event-codes.h as fallback for runtime systems without linux headers
19-
RUN cp -a \
20-
"$(find /usr -type f -name input-event-codes.h -print -quit)" \
21-
"$(find "${TARGET}" -type f -name uinput.py -printf '%h\n' -quit)"
28+
cp -a \
29+
"$(find /usr -type f -name input-event-codes.h -print -quit)" \
30+
"$(find "${TARGET}" -type f -name uinput.py -printf '%h\n' -quit)"
2231

2332
# Create short name symlinks for static libraries
24-
RUN suffix=".cpython-*-$(uname -m)-linux-gnu.so" && \
25-
find "${TARGET}" -type f -path "*/site-packages/*${suffix}" \
26-
| while read -r path; do ln -sfr "${path}" "${path%${suffix}}.so"; done
33+
suffix=".cpython-*-$(uname -m)-linux-gnu.so"
34+
find "${TARGET}" -type f -path "*/site-packages/*${suffix}" \
35+
| while read -r path; do ln -sfr "${path}" "${path%${suffix}}.so"; done
2736

2837
# Put AppStream metadata to required location according to https://wiki.debian.org/AppStream/Guidelines
29-
RUN metainfo=/build/usr/share/metainfo && \
30-
mkdir -p "${metainfo}" && \
31-
cp -a scripts/sc-controller.appdata.xml "${metainfo}"
38+
metainfo=/build/usr/share/metainfo
39+
mkdir -p "${metainfo}"
40+
cp -a scripts/sc-controller.appdata.xml "${metainfo}"
3241

3342
# Convert icon to png format (required for icons in .desktop file)
34-
RUN iconpath="${TARGET}/share/icons/hicolor/512x512/apps" && \
35-
mkdir -p "${iconpath}" && \
36-
rsvg-convert --background-color none -o "${iconpath}/sc-controller.png" images/sc-controller.svg
43+
iconpath="${TARGET}/share/icons/hicolor/512x512/apps"
44+
mkdir -p "${iconpath}"
45+
rsvg-convert --background-color none -o "${iconpath}/sc-controller.png" images/sc-controller.svg
46+
EOR
3747

3848
# Store build metadata
3949
ARG TARGETOS TARGETARCH TARGETVARIANT

0 commit comments

Comments
 (0)