Set up automatic deployment to fly.io
This commit is contained in:
parent
955f0808c5
commit
a2801de697
|
@ -0,0 +1,12 @@
|
|||
name: Fly Deploy
|
||||
on: [push]
|
||||
env:
|
||||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy app
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: superfly/flyctl-actions/setup-flyctl@master
|
||||
- run: flyctl deploy --remote-only
|
|
@ -0,0 +1,29 @@
|
|||
FROM rust:1 AS builder
|
||||
|
||||
# Make a fake Rust app to keep a cached layer of compiled crates
|
||||
RUN USER=root cargo new app
|
||||
WORKDIR /usr/src/app
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
# Needs at least a main.rs file with a main function
|
||||
RUN mkdir src && echo "fn main(){}" > src/main.rs
|
||||
# Will build all dependent crates in release mode
|
||||
RUN cargo build --release
|
||||
|
||||
# Copy the rest
|
||||
COPY . .
|
||||
# Build (install) the actual binaries
|
||||
RUN cargo install --path .
|
||||
|
||||
# Runtime image
|
||||
FROM debian:stable-slim
|
||||
|
||||
# Run as "app" user
|
||||
RUN useradd -ms /bin/bash app
|
||||
|
||||
USER app
|
||||
WORKDIR /app
|
||||
|
||||
# Get compiled binaries from builder's cargo install directory
|
||||
COPY --from=builder /usr/local/cargo/bin/protocol-z-cash /app/protocol-z-cash
|
||||
|
||||
# No CMD or ENTRYPOINT, see fly.toml with `cmd` override.
|
|
@ -0,0 +1,41 @@
|
|||
# fly.toml file generated for protocol-z-cash on 2022-04-28T10:49:01Z
|
||||
|
||||
app = "protocol-z-cash"
|
||||
|
||||
kill_signal = "SIGINT"
|
||||
kill_timeout = 5
|
||||
processes = []
|
||||
|
||||
[env]
|
||||
|
||||
[experimental]
|
||||
allowed_public_ports = []
|
||||
auto_rollback = true
|
||||
cmd = "./protocol-z-cash"
|
||||
|
||||
[[services]]
|
||||
http_checks = []
|
||||
internal_port = 3000
|
||||
processes = ["app"]
|
||||
protocol = "tcp"
|
||||
script_checks = []
|
||||
|
||||
[services.concurrency]
|
||||
hard_limit = 25
|
||||
soft_limit = 20
|
||||
type = "connections"
|
||||
|
||||
[[services.ports]]
|
||||
force_https = true
|
||||
handlers = ["http"]
|
||||
port = 80
|
||||
|
||||
[[services.ports]]
|
||||
handlers = ["tls", "http"]
|
||||
port = 443
|
||||
|
||||
[[services.tcp_checks]]
|
||||
grace_period = "1s"
|
||||
interval = "15s"
|
||||
restart_limit = 0
|
||||
timeout = "2s"
|
Loading…
Reference in New Issue