You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
1.1 KiB

from "golang:latest"
PROTOC_VERSION = "3.11.4"
PROTOC_URL = "https://github.com/protocolbuffers/protobuf/releases/download/v#{PROTOC_VERSION}/protoc-#{PROTOC_VERSION}-linux-x86_64.zip"
NATS_VERSION = "2.1.6"
NATS_URL = "https://github.com/nats-io/nats-server/releases/download/v#{NATS_VERSION}/nats-server-v#{NATS_VERSION}-linux-amd64.zip"
def download(name, url)
run "curl -sSL -o /#{name} '#{url}'"
yield "/#{name}"
run "rm -f /#{name}"
end
run "apt update && apt install sudo unzip -y"
run %q[grep -vE 'env_reset|secure_path' /etc/sudoers >tmp && mv tmp /etc/sudoers]
run %q[echo 'username ALL=(ALL:ALL) NOPASSWD:ALL' >>/etc/sudoers]
download("protoc.zip", PROTOC_URL) do |path|
run "unzip #{path} -d /usr"
run "chmod -R 755 /usr/bin/protoc /usr/include/google"
end
download("nats-server.zip", NATS_URL) do |path|
run "unzip #{path} -d /tmp"
run "mv /tmp/nats-server-v#{NATS_VERSION}-linux-amd64/nats-server /usr/bin"
run "chmod 755 /usr/bin/nats-server"
end
copy "entrypoint.sh", "/entrypoint.sh"
run "chmod 755 /entrypoint.sh"
set_exec entrypoint: %w[sh /entrypoint.sh], cmd: %w[bash]