Skip to content

Commit a3eaee1

Browse files
committed
[fix] docker image less then 100Mb
1 parent d6430f5 commit a3eaee1

File tree

4 files changed

+26
-33
lines changed

4 files changed

+26
-33
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
.git/
22
dist/
33
build/
4+
env/
5+
postgresql/
6+
__pycache__
7+
*.egg-info/
8+
screenshots/

Dockerfile

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,32 @@
1-
FROM python:2.7-alpine
1+
FROM alpine
22
MAINTAINER Mosquito <me@mosquito.su>
33

44
ENV ADDRESS=0.0.0.0
55
ENV PORT=80
66
ENV STORAGE=/usr/lib/pypi-server
7+
ENV PYPI_SERVER_SRC=/usr/local/src/pypi-server
78

8-
COPY ./ /usr/local/src
9-
10-
WORKDIR /usr/local/src
11-
RUN set -ex \
12-
&& apk add --no-cache --virtual .build-deps \
13-
gcc \
14-
libffi-dev \
15-
openssl-dev \
16-
musl-dev \
17-
libxml2-dev \
18-
libxslt-dev \
19-
curl-dev \
20-
&& pip install \
21-
PyMySQL \
22-
&& python setup.py install --prefix=/usr/local \
23-
&& rm -rf /usr/local/src/{*,.*??} \
24-
&& find /usr/local -depth \
25-
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
26-
-exec rm -rf '{}' + \
27-
&& runDeps="$( \
28-
scanelf --needed --nobanner --recursive /usr/local \
29-
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
30-
| sort -u \
31-
| xargs -r apk info --installed \
32-
| sort -u \
33-
)" \
34-
&& apk add --no-cache --virtual .pypi-server-rundeps \
35-
$runDeps \
36-
py-psycopg2 \
37-
&& apk del .build-deps
9+
RUN apk add --no-cache \
10+
py-mysqldb \
11+
py-psycopg2 \
12+
py-curl \
13+
py-openssl \
14+
py-cffi \
15+
py-cparser \
16+
py-lxml
17+
18+
COPY ./ /tmp
19+
20+
RUN set -ex && \
21+
apk add --no-cache --virtual .build-deps gcc py-pip python-dev musl-dev && \
22+
pip list && \
23+
pip install '/tmp' && \
24+
apk del .build-deps
3825

3926
VOLUME "/usr/lib/pypi-server"
4027

4128
COPY docker-entrypoint.sh /entrypoint.sh
29+
RUN rm -rf /root/.cache /var/cache/*
4230

4331
EXPOSE 80
4432

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
COMMIT = $(shell git rev-parse --verify HEAD | cut -c1-8)
22
VERSION = $(shell python setup.py --version)
33

4-
all: rpm deb docker-image
4+
all: docker-image rpm deb
55

66
rpm: rpm-image
77
docker run --rm -t \

pypi_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
("Dmitry Orlov", "me@mosquito.su")
1010
]
1111

12-
version_info = (0, 4, 4)
12+
version_info = (0, 4, 5)
1313

1414
__version__ = ".".join(map(str, version_info))
1515
__author__ = ", ".join("{0} <{1}>".format(*author) for author in author_info)

0 commit comments

Comments
 (0)