Skip to content

Instantly share code, notes, and snippets.

package: coreutils
paths:
- /usr/bin/cat
cmd:
- /usr/bin/cat
- /read/data
Hello World!
type: oci
package: dogsbody-image.tgz
paths:
- /app/
- /usr/local/bin/
- /usr/local/lib/
- /usr/local/include/
- /usr/local/bundle/
cmd:
- ruby
require "socket"
require "file_utils"
require "http/server"
require "json"
class FnHelper
getter(url : String) { ENV.fetch "FN_LISTENER", "unix:/tmp/iofs/lsnr.sock" }
getter(socket_path : String) { url[5..] }
getter(private_socket_path : String) { socket_path + ".private" }
getter? linked : Bool = false
FROM crystallang/crystal
RUN mkdir /tmp/crystal-cache
ENV CRYSTAL_CACHE_DIR /tmp/crystal-cache
WORKDIR /app
COPY func.cr .
RUN crystal build func.cr
RUN mkdir -p /tmp/iofs
CMD ./func
STDERR.puts "HELP, I AM TRAPPED IN A CRYSTAL MAZE!"
require "socket"
require "file_utils"
class FnHelper
getter(url : String) { ENV.fetch "FN_LISTENER", "unix:/tmp/iofs/lsnr.sock" }
getter(socket_path : String) { url[5..] }
getter(private_socket_path : String) { socket_path + ".private" }
getter? linked : Bool = false
getter(private_socket : UNIXServer) do
require "socket"
require "file_utils"
require "http/server"
require "json"
class FnHelper
getter(url : String) { ENV.fetch "FN_LISTENER", "unix:/tmp/iofs/lsnr.sock" }
getter(socket_path : String) { url[5..] }
getter(private_socket_path : String) { socket_path + ".private" }
getter? linked : Bool = false
require "socket"
require "file_utils"
require "http/server"
require "json"
class FnHelper
getter(url : String) { ENV.fetch "FN_LISTENER", "unix:/tmp/iofs/lsnr.sock" }
getter(socket_path : String) { url[5..] }
getter(private_socket_path : String) { socket_path + ".private" }
getter? linked : Bool = false
require "http/server"
require "json"
module FnHelper
def self.socket_path
ENV.["FN_LISTENER"].try(&.[5..]) || "/tmp/iofs/lsnr.sock"
end
def self.handle(&block : JSON::Any -> String)
server = HTTP::Server.new do |context|