jdormit-infra/prod/gitea/packer/Rakefile
2024-02-11 23:24:45 -05:00

37 lines
866 B
Ruby

require "erb"
task :default => ["packer-manifest.json"]
file "packer-manifest.json" => [
"gitea.json",
"scripts/dependencies.sh",
"scripts/volume.sh",
"files/gitea.service",
"files/app.ini",
"files/certbot-renew.service",
"files/certbot-renew.timer",
"scripts/gitea.sh",
"files/gitea-nginx.conf",
"scripts/nginx.sh",
"tmp/do.ini"
] do |t|
sh "packer build gitea.json"
end
file "files/app.ini" => ["templates/app.ini.template"] do |t|
template = ERB.new(File.read(t.source))
File.write(t.name, template.result)
end
file "tmp/do.ini" => ["templates/do.ini.template", "tmp"] do |t|
template = ERB.new(File.read(t.source))
File.write(t.name, template.result)
chmod 0600, "tmp/do.ini"
end
directory "tmp"
def env(var)
ENV[var] || raise("Variable #{var} not found")
end