Skip to content

Instantly share code, notes, and snippets.

@samdphillips
Last active September 9, 2025 00:18
Show Gist options
  • Select an option

  • Save samdphillips/8d77acf1d3e8999f65ed6e9f51233c37 to your computer and use it in GitHub Desktop.

Select an option

Save samdphillips/8d77acf1d3e8999f65ed6e9f51233c37 to your computer and use it in GitHub Desktop.
Some Racket Dockerfiles
# Long running server program
FROM --platform=linux/amd64 racket/racket:8.6-full AS build
# ARGs for catalog urls so we don't need to repeat them
ARG RELEASE_CATALOG=https://download.racket-lang.org/releases/8.6/catalog/
ARG RACKSNAPS_CATALOG=https://racksnaps.defn.io/snapshots/2022/08/25/catalog/
ARG SP_CATALOG=https://samdphillips.github.io/package-catalog/catalog/
WORKDIR /src/ct-truck
RUN raco pkg config --set catalogs ${RELEASE_CATALOG} ${RACKSNAPS_CATALOG} ${SP_CATALOG}
COPY src /src/ct-truck/src
ADD ${RELEASE_CATALOG}pkgs-all /src/release-pkgs-stamp
ADD ${RACKSNAPS_CATALOG}pkgs-all /src/racksnaps-pkgs-stamp
ADD ${SP_CATALOG}pkgs-all /src/sp-pkgs-stamp
RUN raco pkg install --auto --batch --link --name ct-truck /src/ct-truck/src
RUN raco test -x --package ct-truck
RUN raco setup --check-pkg-deps --unused-pkg-deps --pkgs ct-truck
RUN raco exe --vv ++lib keyring/backend/env -o ct-truck src/main.rkt
RUN raco distribute /ct-truck ct-truck
FROM --platform=linux/amd64 ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt update && apt install -y dumb-init ca-certificates openssl tzdata && apt clean && rm -rf /var/lib/apt/lists/*
COPY --from=build /ct-truck /ct-truck
CMD ["dumb-init", "-v", "-r", "15:2", "/ct-truck/bin/ct-truck"]
# Script. Can accept arguments from the docker command line
FROM racket/racket:8.2-full AS build
RUN raco pkg config --set catalogs \
https://download.racket-lang.org/releases/8.2/catalog/ \
https://racksnaps.defn.io/snapshots/2021/07/25/catalog/
COPY the-script-dir /src/the-script-dir
WORKDIR /src/the-script-dir
RUN raco pkg install --auto --batch --name the-script $(pwd)
RUN raco exe --vv ++lib keyring/backend/env -o the-script /src/the-script-dir/main.rkt
RUN raco distribute /the-script the-script
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt update && apt install -y dumb-init ca-certificates openssl tzdata && apt clean && rm -rf /var/lib/apt/lists/*
COPY --from=build /the-script /the-script
ENV PLTSTDOUT=info@the-script
ENTRYPOINT ["/the-script/bin/the-script"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment