Reduce docker image size by 35%
Since docker caches each instruction as a layer, we have to clean cached packages at the end of each step for minimal image size.
This commit is contained in:
@@ -15,8 +15,8 @@ RUN bun run build
|
|||||||
# Base fedora container
|
# Base fedora container
|
||||||
FROM --platform=$TARGETARCH quay.io/fedora/fedora:42 AS base
|
FROM --platform=$TARGETARCH quay.io/fedora/fedora:42 AS base
|
||||||
RUN dnf -y update && dnf install -y python3.13 libnetfilter_queue \
|
RUN dnf -y update && dnf install -y python3.13 libnetfilter_queue \
|
||||||
libnfnetlink libmnl libcap-ng-utils nftables git \
|
libnfnetlink libmnl libcap-ng-utils nftables \
|
||||||
vectorscan libtins python3-nftables libpcap uv
|
vectorscan libtins python3-nftables libpcap && dnf clean all
|
||||||
|
|
||||||
RUN mkdir -p /execute/modules
|
RUN mkdir -p /execute/modules
|
||||||
WORKDIR /execute
|
WORKDIR /execute
|
||||||
@@ -37,10 +37,10 @@ FROM --platform=$TARGETARCH base AS final
|
|||||||
ADD ./backend/requirements.txt /execute/requirements.txt
|
ADD ./backend/requirements.txt /execute/requirements.txt
|
||||||
COPY ./fgex-lib /execute/fgex-lib
|
COPY ./fgex-lib /execute/fgex-lib
|
||||||
|
|
||||||
RUN dnf install -y gcc-c++ python3.13-devel uv git &&\
|
RUN dnf -y update && dnf install -y gcc-c++ python3.13-devel uv git &&\
|
||||||
uv pip install --no-cache --system ./fgex-lib &&\
|
uv pip install --no-cache --system ./fgex-lib &&\
|
||||||
uv pip install --no-cache --system -r /execute/requirements.txt &&\
|
uv pip install --no-cache --system -r /execute/requirements.txt &&\
|
||||||
dnf remove -y gcc-c++ python3.13-devel uv git
|
uv cache clean && dnf remove -y gcc-c++ python3.13-devel uv git && dnf clean all
|
||||||
|
|
||||||
COPY ./backend/ /execute/
|
COPY ./backend/ /execute/
|
||||||
COPY --from=compiler /execute/cppregex /execute/cpproxy /execute/modules/
|
COPY --from=compiler /execute/cppregex /execute/cpproxy /execute/modules/
|
||||||
|
|||||||
Reference in New Issue
Block a user