Skip to content
terminal

GitHub Action

Build GraalVM Executable and Push To Railway

v1.0.0 Latest version

Build GraalVM Executable and Push To Railway

terminal

Build GraalVM Executable and Push To Railway

Build a GraalVM native executable and deploy it to Railway using GitHub Actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Build GraalVM Executable and Push To Railway

uses: arielhernandezcl/[email protected]

Learn more about this action in arielhernandezcl/build-graalvm-deploy-railway

Choose a version

Build GraalVM Executable and Push To Railway

This GitHub Action builds a native GraalVM executable and deploys it to Railway.

Description

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.

Inputs

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.

Requirements

  • 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.

Dockerfile Reference

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"]

Notes

  • 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

Contributions are welcome. Please open an issue or pull request in the action repository.