Deploying a Modern Grails App

Site Admin · 11 Sep 2026 · 8 views

Deployment Options

Modern Grails applications can be deployed in several ways depending on your infrastructure: as a standalone JAR, a WAR file for servlet containers, or as a GraalVM native image.

Building a Fat JAR

# Build the application
gradlew assemble

# The JAR is in build/libs/
java -jar build/libs/myapp-0.1.jar

Docker Deployment

# Dockerfile
FROM eclipse-temurin:17-jre-alpine
WORKDIR /app
COPY build/libs/myapp-0.1.jar app.jar
EXPOSE 8080
CMD ["java", "-jar", "app.jar"]
# Build and run
docker build -t myapp .
docker run -p 8080:8080 myapp

Cloud Deployment

For cloud platforms like AWS, GCP, or Heroku:

  • Heroku - Use the Java buildpack with gradlew build
  • AWS - Deploy JAR to ECS, Lambda, or Elastic Beanstalk
  • GCP - Use Cloud Run or App Engine

GraalVM Native Image

# Build native image
gradlew nativeCompile

# Run (no JVM required)
./build/native/nativeCompile/myapp

Native images start in milliseconds, making them ideal for serverless deployments.

Key Points

  • gradlew assemble builds a fat JAR for standalone deployment.
  • Docker provides consistent deployment across environments.
  • GraalVM native images offer instant startup for serverless.
  • Cloud platforms support various Grails deployment options.
  • The fat JAR includes all dependencies for easy deployment.
Share this post:

Comments (0)

Please login or register to comment.