-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathzxing.dockerfile
65 lines (54 loc) · 1.82 KB
/
zxing.dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# This Dockerfile builds the zxing wheel
# Inputs:
# - ZXING_VERSION - Version to build
#
# Stage: builder
# Purpose:
# - Build the zxing wheel
#
FROM python:3.12-slim-bookworm AS builder
ARG ZXING_VERSION=2.3.0
ARG DEBIAN_FRONTEND=noninteractive
ARG BUILD_PACKAGES="\
build-essential \
# https://github.com/zxing-cpp/zxing-cpp#build-instructions
cmake"
WORKDIR /usr/src
# As this is an base image for a multi-stage final image
# the added size of the install is basically irrelevant
RUN set -eux \
&& echo "Installing build tools" \
&& apt-get update --quiet \
&& apt-get install --yes --quiet --no-install-recommends ${BUILD_PACKAGES} \
&& echo "Installing Python tools" \
&& python3 -m pip install --no-cache-dir --upgrade pip wheel \
&& echo "Building zxing wheel ${ZXING_VERSION}" \
&& cd /usr/src \
&& mkdir wheels \
&& python3 -m pip wheel \
# Build the package at the required version
zxing-cpp==${ZXING_VERSION} \
# Output the *.whl into this directory
--wheel-dir wheels \
--no-binary="zxing-cpp" \
# Do use binary packages for dependencies
--prefer-binary \
# Don't cache build files
--no-cache-dir \
&& ls -ahl wheels/ \
&& echo "Gathering package data" \
&& dpkg-query -f '${Package;-40}${Version}\n' -W > ./wheels/pkg-list.txt \
&& echo "Cleaning up image" \
&& apt-get -y purge ${BUILD_PACKAGES} \
&& apt-get -y autoremove --purge \
&& rm -rf /var/lib/apt/lists/*
#
# Stage: package
# Purpose: Holds the compiled .whl files in a tiny image to pull
#
FROM scratch AS package
LABEL org.opencontainers.image.description="A image with zxing wheel built in /usr/src/zxing/"
WORKDIR /usr/src/zxing/
COPY --from=builder /usr/src/wheels/*.whl ./
COPY --from=builder /usr/src/wheels/pkg-list.txt ./
ENTRYPOINT [ "/usr/bin/bash" ]