From 2dc0152788c05282ff0ebd4468ce768033e0b0fa Mon Sep 17 00:00:00 2001 From: Dev Mukherjee Date: Tue, 25 Apr 2023 09:48:05 +1000 Subject: [PATCH] feat: example of docker labels REFS #64 adds labels that are displayed by the github container registry there are various other labels that the open container spec outlines https://github.com/opencontainers/image-spec/blob/main/annotations.md\#pre-defined-annotation-keys we should consider specifying values for the ones we think are useful note that this is pending update on documentation --- Dockerfile | 4 ++++ Dockerfile.prod | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5e855ba..535ca95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,3 +34,7 @@ RUN poetry install --no-root # uvicorn at this level so it sees the package WORKDIR /opt/ +# Labels are used to identify the image +LABEL org.opencontainers.image.source="https://github.com/anomaly/${PROJ_NAME}" +LABEL org.opencontainers.image.description="A Python web server using FastAPI and Uvicorn" +LABEL org.opencontainers.image.licenses="Apache-2.0" \ No newline at end of file diff --git a/Dockerfile.prod b/Dockerfile.prod index 5043dc9..87b5f74 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -73,5 +73,7 @@ COPY ./src/. . # Expose ports which is proxied via traefik EXPOSE 80 -# ENTRYPOINT ["gunicorn", "--worker-tmp-dir=/dev/shm", "--worker-class=uvicorn.workers.UvicornWorker", "--bind=0.0.0.0:80", "labs.api:app"] -# CMD [] +# Labels are used to identify the image +LABEL org.opencontainers.image.source="https://github.com/anomaly/${PROJ_NAME}" +LABEL org.opencontainers.image.description="A Python web server using FastAPI and Uvicorn" +LABEL org.opencontainers.image.licenses="Apache-2.0" \ No newline at end of file