Skip to content

Commit fa6ad1d

Browse files
author
Hugo Camino
committed
Dockerfile refactor to avoid layer creation (ADD . $APP_HOME) before requirements installation.
1 parent 4e19bed commit fa6ad1d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Dockerfile

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
77
ENV PYTHONUNBUFFERED=1 ENVIRONMENT=pre APP_HOME=/microservice/
88
ENV DATABASE_DIR=database
99
ENV CONFIGMAP_FILE="$APP_HOME"config-docker.yml
10-
RUN mkdir $APP_HOME && adduser -S -D -H python
1110

11+
RUN mkdir $APP_HOME && adduser -S -D -H python
1212
RUN chown -R python $APP_HOME
1313
WORKDIR $APP_HOME
14+
15+
ADD requirement*.txt $APP_HOME
16+
RUN pip install --upgrade pip
17+
RUN pip install -r requirements-docker.txt
18+
1419
ADD . $APP_HOME
1520
RUN mkdir $DATABASE_DIR
1621
RUN chmod 777 $DATABASE_DIR
17-
RUN ls -lah
18-
RUN pip install --upgrade pip
19-
RUN pip install -r requirements-docker.txt
2022

2123
EXPOSE 5000
2224
USER python

0 commit comments

Comments
 (0)