Skip to content

Commit 136ec02

Browse files
author
Dmitry Orlov
committed
[fix] sqlite and fix docker image
1 parent b4bc59b commit 136ec02

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

Dockerfile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,26 @@ ENV STORAGE=/usr/lib/pypi-server
77
ENV PYPI_SERVER_SRC=/usr/local/src/pypi-server
88

99
RUN apk add --no-cache \
10-
py-mysqldb \
11-
py-psycopg2 \
10+
libffi \
11+
py-cparser \
1212
py-curl \
13+
py-lxml \
14+
py-mysqldb \
1315
py-openssl \
14-
py-cffi \
15-
py-cparser \
16-
py-lxml
16+
py-psycopg2 \
17+
py-setuptools
1718

1819
COPY ./ /tmp
1920

2021
RUN set -ex && \
21-
apk add --no-cache --virtual .build-deps gcc py-pip python-dev musl-dev && \
22-
pip --no-cache-dir install '/tmp' && \
22+
apk add --no-cache --virtual .build-deps \
23+
gcc \
24+
libffi-dev \
25+
musl-dev \
26+
py-pip \
27+
python-dev \
28+
&& \
29+
pip --no-cache-dir install -U '/tmp' && \
2330
apk del .build-deps
2431

2532
VOLUME "/usr/lib/pypi-server"

docker-entrypoint.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,22 @@ def check_port(host, port):
3333
if not args or args[0].startswith('-'):
3434
db_url = parse_url(os.getenv('DB', ''))
3535
host = db_url.hostname
36-
port = int(db_url.port or DEFAULT_PORTS[db_url.scheme])
36+
37+
if 'sqlite' in db_url.scheme.lower():
38+
port = None
39+
else:
40+
port = int(db_url.port or DEFAULT_PORTS[db_url.scheme])
3741

3842
args.insert(0, '/usr/bin/pypi-server')
3943

40-
while not check_port(db_url.hostname, port):
44+
while port and not check_port(db_url.hostname, port):
4145
log.info('Awaiting database...')
4246
sleep(1)
4347
continue
4448

4549
# Ensure database engine is ready
46-
sleep(5)
50+
if port:
51+
sleep(5)
4752

4853
executable = args[0]
4954

0 commit comments

Comments
 (0)