carsoncoder.com/Dockerfile
2026-04-15 20:29:59 -04:00

35 lines
748 B
Docker
Executable file

# syntax=docker/dockerfile:1.4
FROM --platform=$BUILDPLATFORM alpine:edge AS builder
RUN <<EOF
apk update
apk add python
apk add --update --no-cache python3 py3-pip fortune && ln -sf python3 /usr/bin/python
python3 -m ensurepip
pip3 install --no-cache --upgrade pip setuptools --break-system-packages
EOF
WORKDIR /app
COPY requirements.txt /app
RUN --mount=type=cache,target=/root/.cache/pip \
pip3 install -r requirements.txt --break-system-packages
COPY . /app
ENTRYPOINT ["python3"]
CMD ["src/main.py"]
FROM builder as dev-envs
RUN <<EOF
apk update
apk add git
EOF
RUN <<EOF
addgroup -S docker
adduser -S --shell /bin/bash --ingroup docker vscode
EOF
# install Docker tools (cli, buildx, compose)
COPY --from=gloursdocker/docker / /