This GitHub Action builds a native GraalVM executable and deploys it to Railway.
Railway uses nixpack to build images, but unfortunately it does not support GraalVM. This GitHub action allows you to build the executable and push it to Railway via the CLI along with a Dockerfile to build the image with the executable already created with GraalVM.
This action automates the process of building a native executable using GraalVM and then deploying it on the Railway platform. It is ideal for Java projects that want to take advantage of GraalVM and Railway's ease of deployment, overcoming existing compatibility limitations.
This action requires two inputs:
RAILWAY_TOKEN
(required): Authentication token for Railway.SVC_ID
(required): Service ID on Railway where the application will be deployed.
- Your project must support GraalVM and have a
pom.xml
configured for native compilation. - You must have a Railway account and have created a service for deployment.
Here is an example Dockerfile that you can use as a reference for your project:
FROM ghcr.io/graalvm/jdk-community:21
WORKDIR /app
COPY appBuild /app
EXPOSE 8080
CMD ["./appBuild"]
- This action uses GraalVM Community Edition with Java 21. - ghcr.io/graalvm/jdk-community:21
- Skips tests during compilation to speed up the process.
- Remember that the name of the executable in the Dockerfile (
appBuild
) must match the name of the file generated by the GitHub action. - By using this action, you ensure that the native GraalVM executable is built correctly before being deployed to Railway, avoiding compatibility issues with nixpack.
Contributions are welcome. Please open an issue or pull request in the action repository.