Skip to content

Instantly share code, notes, and snippets.

@chenyaofo
Last active June 28, 2022 18:01
Show Gist options
  • Save chenyaofo/900aae2d8d494f8baf96c1ebc321662b to your computer and use it in GitHub Desktop.
Save chenyaofo/900aae2d8d494f8baf96c1ebc321662b to your computer and use it in GitHub Desktop.
# syntax = docker/dockerfile:1.3
FROM python:3.9-slim as builder
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential
RUN --mount=type=cache,target=/root/.cache/pip,id=pip_cache,sharing=locked \
pip wheel --wheel-dir /wheels pycocotools
FROM python:3.9-slim
RUN --mount=type=bind,from=builder,source=/wheels,target=/wheels \
pip install --no-cache /wheels/*
# doc from: https://yeasy.gitbook.io/docker_practice/buildx/buildkit
# build command:
# docker buildx build -t app --progress plain .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment