Last active
August 16, 2022 15:43
-
-
Save ditsuke/8b7f791ed7e1a6eb79eb4e833daef02a to your computer and use it in GitHub Desktop.
Phoenix deployment on fly.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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