Files
floci/docker/Dockerfile.native-package
T
Hector Ventura 96264cde70 chore(build): make the native image build locally and give the Makefile a development workflow (#4271)
The Quarkus container build of the native binary failed on Apple Silicon with
GraalVM's BranchTargetOutOfBoundsException in a generated AwsQueryController
invoker (Quarkus 3.39 turns on -H:+AOTSingleCallsiteInline for Mandrel 25.0.4+),
and the packaged image died at startup because the builder links zlib
dynamically while ubi9-micro ships no libz.so.1. `make native` passes the same
flags CI does (-Ob,-H:-AOTSingleCallsiteInline), stages native/<arch>/ like the
workflow, and copies libz.so.1 from the builder image next to the binary, which
Dockerfile.native-package now puts on LD_LIBRARY_PATH.

The Makefile becomes the entry point for development: help (default), dev,
build, test T=, native (container build), native-host (host GraalVM/Mandrel,
adding the Mandrel-only flag when native-image reports Mandrel), run-native,
native-install (PREFIX, default ~/.local), native-image, native-up/native-down/
native-logs against a new docker/compose.native.yml overlay that carries the
five CI compat env vars, clean-sidecars, clean-volumes (a leftover ECR registry
volume is re-adopted on start and breaks the CDK bootstrap), compat SUITES= and
docker-tests. docker/run-docker-tests.sh gains FLOCI_START=0 and COMPAT_SUITES,
validated against the suite list, and its shell test covers both. Docs:
installation (native section rewritten), docker-images, CONTRIBUTING, AGENTS.
2026-09-23 22:35:24 -04:00

53 lines
2.4 KiB
Docker

FROM registry.access.redhat.com/ubi9-micro:9.7
# Automatically set by Docker BuildKit to "amd64" or "arm64"
ARG TARGETARCH
WORKDIR /app
# ubi9-micro has no shadow-utils, so the runtime user is one /etc/passwd line.
RUN echo 'floci:x:1001:0:Floci:/app:/sbin/nologin' >> /etc/passwd \
&& mkdir -p /app/data \
&& chown -R 1001:root /app \
&& chmod -R g+rwX /app
VOLUME /app/data
COPY --chmod=755 docker/entrypoint.sh /usr/local/bin/docker-entrypoint.sh
COPY --chmod=755 docker/localstack-parity.sh docker/healthcheck.sh /usr/local/bin/
ARG VERSION=latest
ENV FLOCI_VERSION=${VERSION}
ENV FLOCI_STORAGE_PERSISTENT_PATH=/app/data
# A binary built in the Quarkus builder container (make native) links zlib dynamically, since
# that image has no zlib-static, and ubi9-micro ships no libz.so.1; the Makefile stages the
# library next to the binary and this is what lets the loader find it. The workflows build
# with a host Mandrel that links zlib statically, so their images carry no such file.
ENV LD_LIBRARY_PATH=/app
COPY --chmod=755 --chown=1001:root native/${TARGETARCH}/ /app/
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 ["/usr/local/bin/healthcheck.sh"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
# A published port needs 0.0.0.0 inside the container, which Floci only accepts with explicit consent.
CMD ["/app/application", "-Dquarkus.http.host=0.0.0.0", "-Dfloci.security.allow-unsafe-network-exposure=true"]