diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..1b3d7d5 --- /dev/null +++ b/Containerfile @@ -0,0 +1,59 @@ +# Roc compiler base image +# Provides just the Roc compiler binary and WASI runtime library. + +ARG ROC_VERSION=0.0.0-alpha2 + +FROM debian:bookworm-slim AS curl-stage +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/* +ARG ROC_VERSION +ARG TARGETARCH +COPY scripts/download-roc.sh /tmp/download-roc.sh +RUN /tmp/download-roc.sh "$ROC_VERSION" "$TARGETARCH" + +FROM debian:bookworm-slim AS base +ARG ROC_VERSION +ARG TARGETARCH +LABEL org.opencontainers.image.title="roc-tools-base" +LABEL org.opencontainers.image.description="Roc compiler base image" +LABEL org.opencontainers.image.version="${ROC_VERSION}" +LABEL org.opencontainers.image.source="https://git.roo.lol/jbrechtel/roc-lang-tools" + +RUN groupadd --gid 1000 roc && useradd --uid 1000 --gid roc --shell /bin/sh --create-home roc + +COPY --from=curl-stage /opt/roc /opt/roc +ENV PATH="/opt/roc/bin:${PATH}" + +USER roc +WORKDIR /home/roc +ENTRYPOINT ["roc"] +CMD ["--help"] + +FROM base AS dev +LABEL org.opencontainers.image.title="roc-tools-dev" +LABEL org.opencontainers.image.description="Roc development environment with LSP and dev tools" +LABEL org.opencontainers.image.version="${ROC_VERSION}" + +USER root +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + curl \ + bash \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +USER roc +ENTRYPOINT ["bash"] + +FROM base AS ci +LABEL org.opencontainers.image.title="roc-tools-ci" +LABEL org.opencontainers.image.description="Roc CI/CD runner image" +LABEL org.opencontainers.image.version="${ROC_VERSION}" + +USER root +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +USER roc +ENTRYPOINT ["roc"] +CMD ["--help"]