Skip to content

Commit be5e3a8

Browse files
committed
Reduce Docker image size
1 parent 51ee5c4 commit be5e3a8

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

Diff for: .dockerignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
venv/
22
.venv
3-
.git/
43
htmlcov/
54
__pycache__/
6-
.github/
75
*.egg-info/
86
.pytest_cache/

Diff for: .github/workflows/publish-docker-image.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: get-tag
1313
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
1414
- name: Build image
15-
run: docker build . -t epicwink/proxpi:${{ steps.get-tag.outputs.tag }}
15+
run: docker buildx build . -t epicwink/proxpi:${{ steps.get-tag.outputs.tag }}
1616
- name: Login to DockerHub
1717
run: >
1818
echo ${{ secrets.DOCKERHUB_PASSWORD }}

Diff for: Dockerfile

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
FROM python:alpine
2-
RUN apk add --no-cache libxslt libxml2
3-
ADD . /root/src/proxpi
4-
RUN apk add --no-cache --virtual .build-deps gcc libc-dev libxslt-dev libxml2-dev \
2+
3+
RUN --mount=source=.,target=/root/src/proxpi,rw \
4+
uname -a && cat /etc/issue && apk --version && python --version && pip --version \
5+
&& apk --no-cache add git \
6+
&& git -C /root/src/proxpi restore .dockerignore \
57
&& pip install /root/src/proxpi \
6-
&& apk del .build-deps
8+
&& apk del --purge git \
9+
&& pip list
10+
711
ENV FLASK_APP=proxpi.server
8-
ENTRYPOINT ["flask"]
9-
CMD ["run", "--host", "0.0.0.0"]
12+
ENTRYPOINT ["flask", "run"]
13+
CMD ["--host", "0.0.0.0"]

0 commit comments

Comments
 (0)