32 lines
892 B
Docker
32 lines
892 B
Docker
# syntax=docker/dockerfile:1
|
|
FROM oven/bun:1.2.2-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# install docker cli + tini; no daemon, just the client
|
|
RUN apk add --no-cache docker-cli tini curl;
|
|
|
|
# ----- map container 'docker' group to host docker.sock GID -----
|
|
# pass the host's docker.sock GID at build time: --build-arg DOCKER_GID=$(stat -c '%g' /var/run/docker.sock)
|
|
ARG DOCKER_GID=977
|
|
# create (or reuse) a group with that GID, then add the existing 'bun' user to it
|
|
RUN addgroup -g "${DOCKER_GID}" -S docker || true \
|
|
&& addgroup bun docker;
|
|
|
|
# switch to the nonroot bun user (already default in the base image, but explicit is nice)
|
|
USER bun
|
|
|
|
# your app
|
|
COPY index.ts ./index.ts
|
|
|
|
# expose your tool server
|
|
EXPOSE 8787
|
|
ENV PORT=8787
|
|
# default docker host path; adjust if you mount elsewhere
|
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
|
|
|
# pid 1 -> tini
|
|
ENTRYPOINT ["/sbin/tini","--"]
|
|
CMD ["bun","index.ts"]
|
|
|