arconia image build dockerfile
The arconia image build dockerfile command packages your Spring Boot application as a container image using a Dockerfile or a Containerfile. Unlike the buildpacks approach, this command gives you full control over the image build process through a custom Dockerfile/Containerfile.
Usage
Basic usage (a Dockerfile or Containerfile must be located at src/main/docker/, src/main/podman/, or in the project root):
arconia image build dockerfile --image-name ghcr.io/arconia-io/configuration-service
With a custom Dockerfile/Containerfile path:
arconia image build dockerfile --image-name ghcr.io/arconia-io/configuration-service --dockerfile config/Dockerfile
Explicitly use Podman as the OCI runtime:
arconia image build dockerfile --image-name ghcr.io/arconia-io/configuration-service --oci-runtime podman
Explicitly use Docker as the OCI runtime:
arconia image build dockerfile --image-name ghcr.io/arconia-io/configuration-service --oci-runtime docker
Options
The following options are available:
| Option | Default | Description |
|---|---|---|
|
(Required) Name (and optionally tag) for the image to build. For example: |
|
|
The path to the Dockerfile or Containerfile to use for building the container image. If not specified, the command looks in these locations (in order):
|
|
|
(auto-detected) |
The OCI runtime to use for building the container image. Supported values: |
|
|
Include verbose output. |
|
Display help information for the command. |
Example Dockerfile/Containerfile
The following is a minimal multi-stage Dockerfile/Containerfile suitable for a Spring Boot application. It uses Spring Boot’s layered JAR support to separate dependencies (which change rarely) from application code (which often changes), resulting in better OCI image layer caching and faster incremental builds:
FROM docker.io/library/eclipse-temurin:25-noble AS builder
WORKDIR /builder
# Adjust this to 'target/*.jar' if you're using Maven
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=tools -jar application.jar extract --layers --destination extracted
FROM docker.io/library/eclipse-temurin:25-jre-noble
RUN useradd spring
USER spring
WORKDIR /application
COPY --from=builder /builder/extracted/dependencies/ ./
COPY --from=builder /builder/extracted/spring-boot-loader/ ./
COPY --from=builder /builder/extracted/snapshot-dependencies/ ./
COPY --from=builder /builder/extracted/application/ ./
ENTRYPOINT ["java", "-jar", "application.jar"]
| The multi-stage build pattern above keeps the final image small by only including the JRE and the extracted application layers, not the full build toolchain. |