Deployment
This guide covers deploying irgo apps to various platforms: desktop distribution, mobile app stores, and web hosting.
Desktop Distribution
macOS
# Build macOS app bundleirgo build desktop macosThis creates a .app bundle in build/desktop/macos/.
For distribution:
- Sign the app with your Apple Developer certificate
- Notarize the app with Apple
- Create a DMG for distribution
# Sign the appcodesign --deep --force --sign "Developer ID Application: Your Name" MyApp.app# Create DMGhdiutil create -volname "MyApp" -srcfolder MyApp.app -ov -format UDZO MyApp.dmg# Notarizexcrun notarytool submit MyApp.dmg --apple-id you@email.com --team-id TEAMID --password @keychain:AC_PASSWORDWindows
# Build Windows executableirgo build desktop windowsCreates .exe in build/desktop/windows/.
For distribution, consider:
- Code signing with a certificate
- Creating an installer (NSIS, WiX, Inno Setup)
- Including Visual C++ redistributables if needed
Linux
# Build Linux binaryirgo build desktop linuxDistribution options:
- AppImage for universal distribution
- Flatpak for sandboxed distribution
- DEB/RPM packages for specific distributions
Mobile App Stores
iOS App Store
- Build the iOS framework:
irgo build ios - Open the Xcode project in
ios/ - Add the framework to your project
- Configure signing with your Apple Developer account
- Archive and upload to App Store Connect
Note
Ensure your app meets Apple's App Store Review Guidelines. Apps using WebViews must provide significant native functionality.
Google Play Store
- Build the Android AAR:
irgo build android - Open the Android project in Android Studio
- Add the AAR to your project
- Configure signing with your keystore
- Generate signed APK or App Bundle
- Upload to Google Play Console
# Generate signed bundle./gradlew bundleReleaseWeb Deployment
Docker
Dockerfile
FROM golang:1.21-alpine AS builderWORKDIR /app# Install templRUN go install github.com/a-h/templ/cmd/templ@latest# Copy and buildCOPY go.mod go.sum ./RUN go mod downloadCOPY . .RUN templ generateRUN CGO_ENABLED=0 go build -o server .# Runtime imageFROM alpine:latestWORKDIR /appCOPY --from=builder /app/server .COPY --from=builder /app/static ./staticEXPOSE 8080CMD ["./server", "serve"]# Build and rundocker build -t myapp .docker run -p 8080:8080 myappFly.io
fly.toml
app = "myapp"primary_region = "ord"[build] dockerfile = "Dockerfile"[http_service] internal_port = 8080 force_https = true[[services]] internal_port = 8080 protocol = "tcp" [[services.ports]] port = 80 handlers = ["http"] [[services.ports]] port = 443 handlers = ["tls", "http"]fly launchfly deployRailway
Railway auto-detects Go apps. Just connect your repository and deploy.
# Set start command in Railway dashboard or railway.json{ "build": { "builder": "DOCKERFILE" }, "deploy": { "startCommand": "./server serve" }}Traditional VPS
# Build locallyGOOS=linux GOARCH=amd64 go build -o myapp .# Upload to serverscp myapp user@server:/opt/myapp/scp -r static user@server:/opt/myapp/# On server: create systemd servicecat > /etc/systemd/system/myapp.service << EOF[Unit]Description=MyAppAfter=network.target[Service]Type=simpleUser=www-dataWorkingDirectory=/opt/myappExecStart=/opt/myapp/myapp serveRestart=always[Install]WantedBy=multi-user.targetEOF# Enable and startsystemctl enable myappsystemctl start myappEnvironment Configuration
// Use environment variables for configurationport := os.Getenv("PORT")if port == "" { port = "8080"}dbURL := os.Getenv("DATABASE_URL")apiKey := os.Getenv("API_KEY")Next Steps
- Desktop Apps - Desktop-specific options
- Mobile Apps - Mobile-specific options
- Examples - Deployment examples
