- refactor(scaffold): move Docker/compose templates and three-stage doc into new containerize-project skill; build-* skills delegate their Docker step - fix(scaffold): drop source mount from the production compose service - fix(scaffold): add .dockerignore templates so COPY . . excludes .git/.env/data - feat(scaffold): run production stages as non-root app user; pin uv install via COPY --from=ghcr.io/astral-sh/uv:0.7 - docs(README): list containerize-project and add-docker-secrets; remove the now-empty _concepts section Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
48 lines
1.3 KiB
Smarty
48 lines
1.3 KiB
Smarty
FROM rocker/r-ver:4.4 AS base
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libcurl4-openssl-dev \
|
|
libssl-dev \
|
|
libxml2-dev \
|
|
libfontconfig1-dev \
|
|
libharfbuzz-dev \
|
|
libfribidi-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN install2.r --error --skipinstalled renv
|
|
|
|
WORKDIR /usr/<package-name>
|
|
|
|
ENV RENV_PATHS_LIBRARY=renv/library
|
|
|
|
# ── production ──────────────────────────────────────────────────────────
|
|
FROM base AS production
|
|
|
|
COPY renv.lock renv.lock
|
|
COPY renv/activate.R renv/activate.R
|
|
|
|
RUN R -e "renv::restore()"
|
|
|
|
COPY . .
|
|
|
|
RUN useradd --create-home --shell /usr/sbin/nologin app \
|
|
&& chown -R app:app /usr/<package-name>
|
|
USER app
|
|
|
|
CMD ["R", "--vanilla", "-e", \
|
|
"pkgload::load_all(); cat('<package-name> ready\\n')"]
|
|
|
|
# ── development ────────────────────────────────────────────────────────
|
|
# Runs as root deliberately: the dev service bind-mounts the source tree
|
|
# and installs packages interactively; a non-root user fights both.
|
|
FROM base AS development
|
|
|
|
COPY renv.lock renv.lock
|
|
COPY renv/activate.R renv/activate.R
|
|
|
|
RUN R -e "renv::restore()"
|
|
|
|
COPY . .
|
|
|
|
CMD ["bash"]
|