Skip to content

Commit

Permalink
Merge pull request #129 from morph027/reduce-docker-image-size
Browse files Browse the repository at this point in the history
reduce docker image size
  • Loading branch information
bohdan-s authored Apr 5, 2024
2 parents 84b4d7b + b7c90c0 commit b4d3a08
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
FROM python:3-slim
FROM python:3 as builder

RUN python3 -m venv /opt/virtualenv \
&& apt-get update \
&& apt-get install build-essential

COPY requirements.txt ./
RUN /opt/virtualenv/bin/pip3 install --no-cache-dir -r requirements.txt

# pycryptodomex 3.14 currently fails to compile for arm64
#RUN apt-get update && apt-get install -y build-essential python3-dev && rm -rf /var/lib/apt/lists/*
FROM python:3-slim

RUN useradd sungather
RUN useradd -r -m sungather

WORKDIR /usr/src/sungather
COPY --from=builder /opt/virtualenv /opt/virtualenv

COPY requirements.txt ./
# pycryptodomex 3.14 currently fails to compile for arm64
#RUN pip install --no-cache-dir --upgrade pycryptodomex==3.11.0 -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
WORKDIR /opt/sungather

COPY SunGather/ .

Expand All @@ -20,4 +23,4 @@ COPY SunGather/config-example.yaml /config/config.yaml

USER sungather

CMD [ "python", "sungather.py", "-c", "/config/config.yaml", "-l", "/logs/" ]
CMD [ "/opt/virtualenv/bin/python", "sungather.py", "-c", "/config/config.yaml", "-l", "/logs/" ]

0 comments on commit b4d3a08

Please sign in to comment.