Skip to content

Instantly share code, notes, and snippets.

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
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
type: oci
package: dogsbody-image.tgz
paths:
- /app/
- /usr/local/bin/
- /usr/local/lib/
- /usr/local/include/
- /usr/local/bundle/
cmd:
- ruby
Hello World!
package: coreutils
paths:
- /usr/bin/cat
cmd:
- /usr/bin/cat
- /read/data