Optionally compile Gitea from source
This commit is contained in:
42
site-cookbooks/kosmos_gitea/recipes/compile_from_source.rb
Normal file
42
site-cookbooks/kosmos_gitea/recipes/compile_from_source.rb
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# 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
|
||||
Reference in New Issue
Block a user