-
Notifications
You must be signed in to change notification settings - Fork 0
/
nixpacks.toml
40 lines (31 loc) · 1.81 KB
/
nixpacks.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# set up some variables to minimize annoyance
providers = ["node"]
[variables]
NPM_CONFIG_UPDATE_NOTIFIER = 'false' # the update notification is relatively useless in a production environment
NPM_CONFIG_FUND = 'false' # the fund notification is also pretty useless in a production environment
NPM_CONFIG_PRODUCTION = 'false'
CADDY_VERSION = '2.8.2' # specify the caddy version to use here, without a 'v' prefix. https://github.com/caddyserver/caddy/releases
NIXPACKS_NODE_VERSION = '20'
# download and untar caddy
[phases.caddy]
dependsOn = ['setup'] # make sure this phase runs after the default 'setup' phase
cmds = [
'curl -fsSLo caddy.tar.gz "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz"', # download the caddy release specified by 'CADDY_VERSION' from GitHub
'tar -zxvf caddy.tar.gz caddy', # only extract 'caddy' from the tarball
'chmod +x caddy' # enable file execution for caddy, needed to execute downloaded files
]
[phases.codegen]
dependsOn = ['install']
cmds = [
'pnpm run prepare'
]
[phases.build]
dependsOn = ["...", "codegen"]
# format the Caddyfile with fmt
[phases.fmt]
dependsOn = ['caddy'] # make sure this phase runs after the 'caddy' phase so that we know we have caddy downloaded
cmds = ['caddy fmt --overwrite Caddyfile'] # format the Caddyfile to fix any formatting inconsistencies
[start]
runImage = 'ubuntu:20.04' # use a new ubuntu image to run the caddy server in
onlyIncludeFiles = ['caddy', 'Caddyfile', 'dist'] # copy only the needed files and folders into the new image (react-scripts builds to a 'build' folder)
cmd = './caddy run --config Caddyfile --adapter caddyfile 2>&1' # start caddy using the Caddyfile config and caddyfile adapter