Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ditsuke
Last active August 16, 2022 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ditsuke/8b7f791ed7e1a6eb79eb4e833daef02a to your computer and use it in GitHub Desktop.
Save ditsuke/8b7f791ed7e1a6eb79eb4e833daef02a to your computer and use it in GitHub Desktop.
Phoenix deployment on fly.io
app = "sample-ephoenix"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[build]
dockerfile = "prod.Dockerfile"
[env]
PORT = "8081"
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
internal_port = 8081
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 50
soft_limit = 40
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "10s"
interval = "15s"
restart_timeout = 0
timeout = "2s"
# syntax=docker/dockerfile:1.3-labs
FROM elixir:latest
COPY . /app
WORKDIR /app
# Env for prod, port control
ENV MIX_ENV=prod PORT=8081
# Install tools
RUN <<EOF
echo "installing rebar..."
mix local.rebar --force
echo "installing hex..."
mix local.hex --force --yes
EOF
# Get dependencies
RUN mix deps.get --only prod
# Compile application and assets
RUN <<EOF
mix do compile
mix assets.deploy
EOF
# Expose directive
EXPOSE 4000
# Needs SECRET_KEY_BASE in env
CMD ["mix", "phx.server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment