Skip to content

Commit

Permalink
Optimize docker image
Browse files Browse the repository at this point in the history
The current image is >1.2gb and not at all optimized. We can utilize the
python-slim base image and remove unnecessary files in the image. With
these changes we cut the image size to less than half (500mb on my local
machine).
  • Loading branch information
Kyle-Verhoog committed Feb 13, 2024
1 parent 4776d42 commit f53cb76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
FROM python:3.12
FROM python:3.12-slim

EXPOSE 8126

ENV SNAPSHOT_CI=1
ENV LOG_LEVEL=INFO
ENV SNAPSHOT_DIR=/snapshots

RUN apt update && apt install -y git

RUN mkdir -p /src
WORKDIR /src
COPY . /src
RUN pip install /src

# Cleanup
RUN apt remove -y git
RUN rm -rf /var/lib/apt/lists/* /root/.cache/pip /tmp/* /var/tmp/* /src

CMD ["ddapm-test-agent"]
4 changes: 4 additions & 0 deletions releasenotes/notes/image-optimization-d614eccb59441217.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
other:
- |
The image size has been cut roughly in half.

0 comments on commit f53cb76

Please sign in to comment.