Files
floci/docker/Dockerfile.native-package
T
Hector Ventura b0a8dff206 perf(docker): drop the gosu layer and two no-op native-image inputs (#3037)
The native image's tools layer installed shadow-utils, which ubi9-minimal
9.7 already ships, and downloaded a gosu binary: 19 MB on disk, 3.66 MB
compressed, byte-identical on every release since 1.5.34. The entrypoint
still starts as root and still grants the bind-mounted Docker socket's
group to the floci user, but through coreutils, which the base image has:
`chroot --userspec=1001:0 --groups=0,<socket gid> --skip-chdir /` drops to
uid 1001 with the socket's gid as a supplementary group. The group is
passed by number, so no /etc/group entry is needed, and --skip-chdir keeps
/app as the working directory where the relative ./data paths resolve. The
layer is now 24.6 kB (one useradd). The JVM Dockerfile drops its gosu
download too: the entrypoint is shared, so once it execs chroot nothing
there calls gosu. Floci's release and nightly pipelines never publish that
image; build-images.yml is a reusable workflow a fork invokes to publish its
own copy, and its noble base carries the same coreutils chroot flags.

Two inputs to the native build go with it, neither changing a byte:
--allow-incomplete-classpath and --report-unsupported-elements-at-runtime
have been no-ops since GraalVM 22.1 (Quarkus passes --link-at-build-time
itself, so a missing reachable class already fails the build), and the
brotli4j platform JNI jars are excluded from quarkus-rest-jackson because
Floci never enables Brotli compression and the jar was never embedded
(resource count unchanged at 197). A native build without them produces
the same 232.25 MB image and the same reachable set.

Verified on the arm64 image: uid=1001 gid=0; a socket owned by gid 999
yields groups=0,999 end to end; /app/data writable; argv fallthrough
intact; sdk-test-java compat suite 1,667/1,667 against the native image
with the socket mounted.
2026-09-04 22:30:28 -04:00

54 lines
2.2 KiB
Docker

FROM registry.access.redhat.com/ubi9-minimal:9.7
ARG VERSION=latest
# Automatically set by Docker BuildKit to "amd64" or "arm64"
ARG TARGETARCH
ENV FLOCI_VERSION=${VERSION}
ENV FLOCI_STORAGE_PERSISTENT_PATH=/app/data
# ubi9-minimal already ships shadow-utils (useradd) and coreutils (chroot), so no package is
# installed and no binary is downloaded: the entrypoint drops privileges with
# `chroot --userspec`, which replaces gosu, and adds the Docker socket's group with
# `chroot --groups`, which replaces the runtime usermod. Measured on 2.0.1 the layer this
# replaces was 3.66 MB compressed and 19 MB on disk.
RUN useradd -r -u 1001 -g root -d /app -s /sbin/nologin floci
WORKDIR /app
RUN mkdir -p /app/data \
&& chown -R 1001:root /app \
&& chmod -R g+rwX /app
VOLUME /app/data
COPY --chmod=755 --chown=1001:root native/${TARGETARCH}/ /app/
COPY --chmod=755 docker/entrypoint.sh /usr/local/bin/docker-entrypoint.sh
COPY --chmod=755 docker/localstack-parity.sh /usr/local/bin/localstack-parity.sh
LABEL org.opencontainers.image.title="Floci" \
org.opencontainers.image.description="Local AWS emulator — open-source alternative to LocalStack Community" \
org.opencontainers.image.url="https://floci.io" \
org.opencontainers.image.source="https://github.com/floci-io/floci" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.vendor="Floci" \
description="Local AWS emulator — open-source alternative to LocalStack Community" \
io.k8s.description="Local AWS emulator — open-source alternative to LocalStack Community" \
io.k8s.display-name="Floci" \
io.openshift.expose-services="4566:tcp" \
io.openshift.tags="floci aws-emulator" \
maintainer="Floci <https://github.com/floci-io/floci>" \
name="floci/floci" \
summary="Local AWS emulator — open-source alternative to LocalStack Community" \
url="https://floci.io" \
vendor="Floci"
EXPOSE 4566
HEALTHCHECK --interval=5s --timeout=3s --retries=5 \
CMD curl -f http://localhost:4566/_floci/health || exit 1
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["/app/application", "-Dquarkus.http.host=0.0.0.0"]