mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 15:21:05 -05:00
* chore(docker): add Dockerfile.jvm-package for the local dev loop docker/Dockerfile runs Maven inside the build, so it re-resolves every dependency and wants a couple of gigabytes. Iterating on a change through it is slow and can fall over on a machine with little headroom. This is the JVM counterpart to Dockerfile.native-package: it consumes the target/quarkus-app an ordinary ./mvnw package already produced, which takes seconds. The runtime half is identical to stage 2 of docker/Dockerfile, which stays the canonical definition. * fix(docker): mirror the canonical runtime stage in Dockerfile.jvm-package The new file said it mirrored stage 2 of docker/Dockerfile and did not. It dropped the EXPOSE 6379-6399 block, which exists for the docker-java compatibility workaround in #2095, so an image that looked equivalent published a different port set to anything reading image metadata for those dynamically assigned Redis and ElastiCache ports. Two smaller divergences went with it: an explicit bash install, which is redundant because eclipse-temurin:25-jre-noble already ships bash 5.2.21, and a cli_follow_urlparam setting that belongs to the canonical file and is not there yet. The runtime stanza is now a copy of the canonical one with exactly two lines changed, the version default and where the application directory is copied from, and DockerfileRuntimeParityTest holds it there: it compares the two stages line for line, comments included, and allows only those two substitutions. Removing a single EXPOSE line fails it with the line that drifted.
84 lines
3.1 KiB
Docker
84 lines
3.1 KiB
Docker
# JVM image built from an artifact that already exists on the host:
|
|
# ./mvnw package -DskipTests && docker build -f docker/Dockerfile.jvm-package -t floci/floci:dev .
|
|
#
|
|
# The counterpart to Dockerfile.native-package, for the JVM runtime: same idea, same reason. It
|
|
# exists for the local loop: docker/Dockerfile runs Maven inside the build, which re-resolves every
|
|
# dependency and wants a couple of gigabytes, so iterating on a change through it is slow and can
|
|
# fall over on a machine with little headroom. Consuming target/quarkus-app takes seconds.
|
|
#
|
|
# Everything below the FROM is a copy of the runtime stage of docker/Dockerfile, which is the
|
|
# canonical definition. Exactly two lines differ, both by design: the default VERSION, and where
|
|
# the application directory is copied from. DockerfileRuntimeParityTest enforces that, so a change
|
|
# to the canonical runtime stage fails the build here until it is mirrored.
|
|
FROM eclipse-temurin:25-jre-noble
|
|
|
|
ARG VERSION=dev
|
|
ENV FLOCI_VERSION=${VERSION}
|
|
ENV FLOCI_STORAGE_PERSISTENT_PATH=/app/data
|
|
|
|
ENV AWS_DEFAULT_REGION=us-east-1
|
|
ENV AWS_ACCESS_KEY_ID=test
|
|
ENV AWS_SECRET_ACCESS_KEY=test
|
|
ENV AWS_CONFIG_FILE=/etc/floci/aws/config
|
|
|
|
# Privilege drop happens in the entrypoint through coreutils chroot, so no gosu
|
|
# download; wget stays for the HEALTHCHECK below.
|
|
RUN set -eux; \
|
|
apt-get update; \
|
|
apt-get install -y --no-install-recommends ca-certificates passwd python3 python3-pip wget; \
|
|
rm -rf /var/lib/apt/lists/*; \
|
|
pip3 install --no-cache-dir --break-system-packages awscli boto3; \
|
|
aws_bin="$(command -v aws)"; \
|
|
mv "$aws_bin" /usr/bin/aws.real; \
|
|
printf '#!/bin/sh\nexec /usr/bin/aws.real --endpoint-url=http://localhost:4566 "$@"\n' > /usr/bin/aws; \
|
|
chmod +x /usr/bin/aws; \
|
|
useradd -r -u 1001 -g root -d /app -s /sbin/nologin floci
|
|
|
|
WORKDIR /app
|
|
|
|
RUN mkdir -p /app/data /etc/floci/aws \
|
|
&& printf '[default]\nendpoint_url = http://localhost:4566\n' > /etc/floci/aws/config \
|
|
&& chown 1001:root /app \
|
|
&& chmod "g+rwX" /app \
|
|
&& chown 1001:root /app/data
|
|
|
|
COPY target/quarkus-app/ quarkus-app/
|
|
RUN chown -R 1001:root /app/quarkus-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
|
|
|
|
VOLUME /app/data
|
|
|
|
EXPOSE 4566
|
|
|
|
# Need to expose separately due to https://github.com/floci-io/floci/issues/2095.
|
|
# This preseres compatibility with https://github.com/docker-java/docker-java/blob/002b6eb7aa2b892be729c7c2a5e95f782924db38/docker-java-api/src/main/java/com/github/dockerjava/api/model/ExposedPort.java#L119
|
|
EXPOSE 6379
|
|
EXPOSE 6380
|
|
EXPOSE 6381
|
|
EXPOSE 6382
|
|
EXPOSE 6383
|
|
EXPOSE 6384
|
|
EXPOSE 6385
|
|
EXPOSE 6386
|
|
EXPOSE 6387
|
|
EXPOSE 6388
|
|
EXPOSE 6389
|
|
EXPOSE 6390
|
|
EXPOSE 6391
|
|
EXPOSE 6392
|
|
EXPOSE 6393
|
|
EXPOSE 6394
|
|
EXPOSE 6395
|
|
EXPOSE 6396
|
|
EXPOSE 6397
|
|
EXPOSE 6398
|
|
EXPOSE 6399
|
|
|
|
HEALTHCHECK --interval=5s --timeout=3s --retries=5 \
|
|
CMD wget -q --spider http://localhost:4566/_floci/health || exit 1
|
|
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
CMD ["java", "--enable-native-access=ALL-UNNAMED", "-jar", "/app/quarkus-app/quarkus-run.jar"]
|