Skip to content

Instantly share code, notes, and snippets.

@moviendome
Created October 1, 2024 02:46
Show Gist options
  • Save moviendome/f5ee2b60f4b55bd52a566ff87bc73f9f to your computer and use it in GitHub Desktop.
Save moviendome/f5ee2b60f4b55bd52a566ff87bc73f9f to your computer and use it in GitHub Desktop.
Loco.rs & Kamal
# dockerfile
FROM rust:1.74-slim as builder
WORKDIR /usr/src/
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim
# added for healthcheck, no needed in kamal 2
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
WORKDIR /usr/app
COPY --from=builder /usr/src/assets/static /usr/app/assets/static
# added for htmx views
COPY --from=builder /usr/src/assets/views /usr/app/assets/views
COPY --from=builder /usr/src/assets/static/404.html /usr/app/assets/static/404.html
COPY --from=builder /usr/src/config /usr/app/config
COPY --from=builder /usr/src/target/release/prelaunch_app-cli /usr/app/prelaunch_app-cli
# probably no needed
EXPOSE 5150
ENTRYPOINT ["/usr/app/prelaunch_app-cli", "start"]
---
# config/production.yaml
...
# not sure if this is the way
binding: 0.0.0.0
...
---
# config/deploy.yml
# pending to upgrade to kamal 2. Simple: no ssl, no domain...
service: prelaunch_app
image: moviendome/prelaunch_app
servers:
- 37.27.84.208
registry:
username: moviendome
password:
- KAMAL_REGISTRY_PASSWORD
env:
clear:
LOCO_ENV: "production"
port: 5150
healthcheck:
path: _health
port: 5150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment