add Docker deployment with Alpine image, release config and health check

- Alpine multi-stage Dockerfile (131 MB image)
- Release overlays (bin/server, bin/migrate), env.sh, Release module
- Health check endpoint at GET /health
- Fly.io config with SQLite volume mount
- Fix hardcoded paths in optimizer.ex and variant_cache.ex to use
  Application.app_dir/2 (breaks in releases where Plug.Static serves
  from a different directory than CWD)
- strip_beams: true in release config
- Optimised .dockerignore and .gitignore for mockup variants

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-08 16:21:05 +00:00
parent eaa4bbb3fa
commit 1ee37c853d
15 changed files with 320 additions and 32 deletions

View File

@@ -25,7 +25,7 @@ if config_env() == :prod do
System.get_env("DATABASE_PATH") ||
raise """
environment variable DATABASE_PATH is missing.
For example: /etc/simpleshop_theme/simpleshop_theme.db
For example: /data/simpleshop_theme.db
"""
config :simpleshop_theme, SimpleshopTheme.Repo,
@@ -97,22 +97,32 @@ if config_env() == :prod do
# ## Configuring the mailer
#
# In production you need to configure the mailer to use a different adapter.
# Here is an example configuration for Mailgun:
# Uncomment ONE of the blocks below and set the matching env vars.
# The API client is already configured in config/prod.exs (Swoosh.ApiClient.Req).
#
# Postmark (recommended):
#
# config :simpleshop_theme, SimpleshopTheme.Mailer,
# adapter: Swoosh.Adapters.Postmark,
# api_key: System.get_env("POSTMARK_API_KEY")
#
# Mailgun:
#
# config :simpleshop_theme, SimpleshopTheme.Mailer,
# adapter: Swoosh.Adapters.Mailgun,
# api_key: System.get_env("MAILGUN_API_KEY"),
# domain: System.get_env("MAILGUN_DOMAIN")
#
# Most non-SMTP adapters require an API client. Swoosh supports Req, Hackney,
# and Finch out-of-the-box. This configuration is typically done at
# compile-time in your config/prod.exs:
# SMTP (any provider):
#
# config :swoosh, :api_client, Swoosh.ApiClient.Req
#
# See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
# config :simpleshop_theme, SimpleshopTheme.Mailer,
# adapter: Swoosh.Adapters.SMTP,
# relay: System.get_env("SMTP_HOST"),
# port: String.to_integer(System.get_env("SMTP_PORT") || "587"),
# username: System.get_env("SMTP_USERNAME"),
# password: System.get_env("SMTP_PASSWORD"),
# tls: :if_available
# Stripe keys are stored encrypted in the database and loaded at runtime
# by SimpleshopTheme.Secrets. No env vars needed.
# Stripe and Printify keys are stored encrypted in the database and loaded
# at runtime by SimpleshopTheme.Secrets. No env vars needed for those.
end