Closed tschaffter closed 3 years ago
Example of the current code from the Date Annotator Example. This code should meet the best practice defined by DL3045 (APP_DIR
an absolute path). My guess is that the linter fails because I used a variable while it's looking for a string that starts with /...
.
ENV APP_DIR=/opt/app
COPY openapi_server ${APP_DIR}/openapi_server
COPY requirements.txt uwsgi.ini ${APP_DIR}/
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
Mu current preferred solution is:
ENV APP_DIR=/opt/app
WORKDIR ${APP_DIR}
COPY openapi_server openapi_server/
COPY requirements.txt prod-requirements.txt uwsgi.ini ./
RUN pip install --no-cache-dir \
-r requirements.txt -r prod-requirements.txt
WORKDIR /
COPY docker-entrypoint.sh .
RUN chmod +x docker-entrypoint.sh
Notes:
APP_DIR
as a kind of standard in all our images to know where the application directory is (may not longer be needed if we always place the app in /opt/app
). I also like to have this variable at the top of the Dockerfile as it quickly indicates the location of the app dir, for example if someone want to troubleshoot the official Docker image and is looking to important directories./
). The Dockerfile would be one line shorter without it.+1 for your current preferred solution. I didn't reallize you could do pip install requirements.txt
without the -r
I didn't reallize you could do pip install requirements.txt without the -r
It's actually a typo. I updated the proposed solution to reflect this typo.
I updated the Dockerfiles of the NLP Sandbox and ROCC.
This new warning makes the
lint
job of most of our repositories fail. The warning is described here.