Skip to content

Commit

Permalink
Fix a bug in DockerFile
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyril ZORMAN committed Feb 24, 2024
1 parent f75b471 commit a8ac3fa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 34 deletions.
54 changes: 20 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,33 @@
FROM debian:bookworm-slim as prod

# activate non free components for mscorefonts
RUN sed -i -e's/Components: main/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources

# install needed packages
RUN apt-get -qq update > /dev/null && DEBIAN_FRONTEND=noninteractive apt-get -qq -y --no-install-recommends install \
dash \
bash \
python3 \
python3-uno \
python3-pip \
libreoffice-nogui \
fonts-liberation \
ttf-mscorefonts-installer \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# These packages resolve the following warning : "Warning: failed to launch javaldx - java may not function correctly"
# but it does not seem to be needed. All tests pass without it. So it is commented out. (it saves 400Mo for the Docker image)
# RUN apt-get -qq update > /dev/null && DEBIAN_FRONTEND=noninteractive apt-get -qq -y --no-install-recommends install \
# default-jre \
# libreoffice-java-common \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN useradd -d /app python

RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib,target=/var/lib/apt,sharing=locked \
--mount=type=cache,id=debconf,target=/var/cache/debconf,sharing=locked \
sed -i -e's/Components: main/Components: main contrib non-free/' /etc/apt/sources.list.d/debian.sources \
&& apt update \
&& apt-get -qq update > /dev/null && DEBIAN_FRONTEND=noninteractive apt-get -qq -y --no-install-recommends install \
dash \
bash \
python3 \
python3-uno \
python3-pip \
libreoffice-nogui \
fonts-liberation \
ttf-mscorefonts-installer \
&& useradd -d /app python
COPY . /app
WORKDIR /app

RUN chown python /app -R \
&& pip install -r requirements.txt --break-system-packages

USER python


From prod as dev
USER root
RUN apt-get -qq update > /dev/null && DEBIAN_FRONTEND=noninteractive apt-get -qq -y --no-install-recommends install \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \

RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib,target=/var/lib/apt,sharing=locked \
--mount=type=cache,id=debconf,target=/var/cache/debconf,sharing=locked \
apt update && \
apt-get -qq update > /dev/null && DEBIAN_FRONTEND=noninteractive apt-get -qq -y --no-install-recommends install curl

RUN USER=python && \
GROUP=python && \
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,8 @@ For trying to fix these problems, you can try:
<a name="versions"></a>Versions
-------------------------------

- v1.5.2 : 2024-02-24 : Better README
- Rewrite for a betterdocker DockerFile without bug
- v1.5.1 : 2024-02-16 : Better README
- Rewriting of the README file
- v1.5.0 : 2024-02-12 : syntax error detection
Expand Down

0 comments on commit a8ac3fa

Please sign in to comment.