Skip to content

Feat: Add docker setup to Astor - #379

Open
Itiro-P wants to merge 3 commits into
SpoonLabs:masterfrom
Itiro-P:master
Open

Itiro-P wants to merge 3 commits into
SpoonLabs:masterfrom
Itiro-P:master

Conversation

@Itiro-P

@Itiro-P Itiro-P commented Aug 27, 2026 •

Copy link
Copy Markdown

This PR aims to close #132 by creating a reusable Docker image to allow users running samples with minimal setup.

The Dockerfile uses multi-stage setup and only stores the target/ directory as result. The build is made using maven image with Java 26* and then setups an image with common JDK's to allow samples with different compliance levels. The image entrypoint is made with Python just like the old's Thomas Durieux image but made to allow the same arguments as the main Astor project.

The container itself copies the target project (which needs to be already compiled) and outputs the results to the host. It's necessary to use mounted volumes so, therefore, it's recommended to only allow read permissions to input project.

Usage:

Clone this branch and build the image:

$ git clone https://github.com/Itiro-P/astor.git
$ cd astor
$ docker build . -t spoonlabs/astor

With a project already compiled, point the input/output directories to the container using volumes:

# Using one of the examples:
$ mkdir -p out
# Spawning a sub-shell so we remain at the root directory of the project after
$ (cd examples/example_return_arthmetic/ && mvn clean compile test -DskipTests)
$ docker run --user $(id -u):$(id -g) \
  -v ./examples/example_return_arthmetic:/input-project/example_return_arthmetic:ro \
  -v ./out:/astor/output_astor spoonlabs/astor -mode jMutRepair

The log of the example's execution above can be seen here.

TODO:

  • Change docs/astor-docker.md to reflect new changes.
  • Publish the image on GitHub Container Registry.

@Itiro-P

Itiro-P commented Aug 27, 2026

Copy link
Copy Markdown
Author

I still need to make the image output the results properly. As soon I finish this issue I make this ready for preview.

@Itiro-P
Itiro-P marked this pull request as ready for review August 27, 2026 19:39
@Itiro-P

Itiro-P commented Aug 27, 2026 •

Copy link
Copy Markdown
Author

Hello, @martinezmatias

The image generated should be solid for production use, for the building process I used the JDK 26 to allow newer projects. Do you want me to override this behavior to Java 8?

Additionally, I can't push the image as I'm not a member of the organization (which is okay for me), though the steps of doing it are simple. After building the image:

Sign at the Container Registry using your credentials:

$ echo <your_personal_access_token> | docker login ghcr.io -u <your_username> --password-stdin

Tag the image with the organization:

$ docker tag spoonlabs/astor:latest ghcr.io/SpoonLabs/astor:latest

Push the image to the Github Container Registry:

$ docker push ghcr.io/SpoonLabs/astor:latest

This should publish the image as a private package. You can change the visibility under the organization's settings.

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker image for running Astor

1 participant