Skip to content

Instantly share code, notes, and snippets.

@saolsen
Created April 16, 2024 14:03

Revisions

  1. saolsen created this gist Apr 16, 2024.
    25 changes: 25 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    ARG DENO_VERSION=1.42.2
    ARG BIN_IMAGE=denoland/deno:bin-${DENO_VERSION}
    FROM ${BIN_IMAGE} AS bin

    FROM frolvlad/alpine-glibc:alpine-3.13

    RUN apk --no-cache add ca-certificates

    RUN addgroup --gid 1000 deno \
    && adduser --uid 1000 --disabled-password deno --ingroup deno \
    && mkdir /deno-dir/ \
    && chown deno:deno /deno-dir/

    ENV DENO_DIR /deno-dir/
    ENV DENO_INSTALL_ROOT /usr/local

    ARG DENO_VERSION
    ENV DENO_VERSION=${DENO_VERSION}
    COPY --from=bin /deno /bin/deno

    WORKDIR /deno-dir
    COPY . .

    ENTRYPOINT ["/bin/deno"]
    CMD ["run", "--allow-env", "--allow-net", "main.ts"]
    23 changes: 23 additions & 0 deletions fly.toml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    app = 'gameplay'
    primary_region = 'ord'

    [build]

    [env]
    PORT = '8000'

    [processes]
    app = 'run --allow-env --allow-net ./main.ts'

    [http_service]
    internal_port = 8000
    force_https = true
    auto_stop_machines = true
    auto_start_machines = true
    min_machines_running = 1
    processes = ['app']

    [[vm]]
    memory = '1gb'
    cpu_kind = 'shared'
    cpus = 1