chef/site-cookbooks/kosmos_gitea/recipes/compile_from_source.rb

43 lines
854 B
Ruby

#
# Cookbook:: kosmos_gitea
# Recipe:: compile_from_source
#
# Compiles/installs Gitea from source
#
include_recipe "git"
node.override["nodejs"]["repo"] = "https://deb.nodesource.com/node_20.x"
include_recipe 'kosmos-nodejs'
node.override["golang"]["version"] = "1.23.9"
include_recipe "golang"
link "/usr/local/bin/go" do
to "/usr/local/go/bin/go"
end
source_dir = "/opt/gitea"
git source_dir do
repository node["gitea"]["repo"]
revision node["gitea"]["revision"]
action :sync
notifies :run, "execute[npm_install]", :immediately
end
execute "npm_install" do
cwd source_dir
command "npm ci"
action :nothing
notifies :run, "bash[compile_gitea]", :immediately
end
bash "compile_gitea" do
cwd source_dir
environment "TAGS" => "bindata"
code "make build"
action :nothing
notifies :restart, "service[gitea]", :delayed
end