Skip to content

Commit f5c4910

Browse files
committed
refactor(dockerfile): simplify the image definition
Improve cachability by reordering COPY directives and removing unnecessary RUN directive. Remove unnecessary user switches. Remove workaround for missing user home directory. Reduce the size of the build context.
1 parent 7d96e65 commit f5c4910

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.*
2+
*.md

Dockerfile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
FROM satosa AS custom_code
2-
# workaround https://github.com/IdentityPython/satosa-docker/issues/6
3-
USER root
4-
RUN mkdir -p /home/satosa; chown satosa:satosa /home/satosa
5-
USER satosa
61
# build custom micro services
2+
FROM satosa AS custom_code
73
COPY --chown=satosa:satosa src /home/satosa/src
84
RUN cd /home/satosa/src/static_content; pip install --user .
95

106
FROM satosa
11-
USER root
12-
RUN pip install --no-cache-dir satosa[ldap]==${SATOSA_VERSION}
13-
COPY --chown=satosa:satosa *.yaml /etc/satosa/
14-
COPY --chown=satosa:satosa plugins /etc/satosa/plugins
15-
RUN mkdir -p /home/satosa; chown satosa:satosa /home/satosa
7+
COPY *.yaml /etc/satosa/
8+
COPY plugins /etc/satosa/plugins
169
COPY --from=custom_code /home/satosa/.local /home/satosa/.local
17-
COPY delayed-entrypoint.sh /usr/local/bin/
18-
USER satosa:satosa
10+
COPY --chown=root:root delayed-entrypoint.sh /usr/local/bin/
1911
ENV STARTUP_DELAY=300
2012
ENTRYPOINT ["delayed-entrypoint.sh"]
2113
CMD ["gunicorn","-b0.0.0.0:8080","satosa.wsgi:app"]

0 commit comments

Comments
 (0)