mirror of
https://github.com/pypiserver/pypiserver
synced 2024-11-09 16:45:51 +01:00
fix docker entrypoint script, improve docker build speed/caching (#344)
Co-authored-by: Pelle Koster <pelle.koster@nginfra.nl>
This commit is contained in:
parent
5ca5351d80
commit
e0bff63ab9
@ -1,41 +1,8 @@
|
||||
*.class
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.o
|
||||
*.so
|
||||
*.os
|
||||
*.pyd
|
||||
*.elc
|
||||
*~
|
||||
.*.swp
|
||||
.*.swo
|
||||
.*.swn
|
||||
.~
|
||||
.DS_Store
|
||||
.ropeproject
|
||||
ID
|
||||
__pycache__/
|
||||
/build/
|
||||
/dist/
|
||||
/*.egg*
|
||||
/MANIFEST
|
||||
/README.html
|
||||
/pypi-server-standalone.py
|
||||
/.project
|
||||
/.pydevproject
|
||||
/.tox/
|
||||
/*.egg-info/
|
||||
/.standalone
|
||||
/.coverage
|
||||
/htmlcov/
|
||||
/.installed.cfg
|
||||
/develop-eggs/
|
||||
/eggs/
|
||||
/parts/
|
||||
/.cache/
|
||||
/.settings/
|
||||
Dockerfile
|
||||
venv
|
||||
.venv
|
||||
.vscode
|
||||
.idea
|
||||
*
|
||||
!pypiserver
|
||||
!requirements
|
||||
!docker-requirements.txt
|
||||
!entrypoint.sh
|
||||
!README.rst
|
||||
!setup.cfg
|
||||
!setup.py
|
||||
|
20
Dockerfile
20
Dockerfile
@ -31,7 +31,12 @@ RUN apk add --no-cache --virtual .build-deps \
|
||||
|
||||
FROM base AS builder_dependencies
|
||||
|
||||
COPY . /code
|
||||
COPY pypiserver /code/pypiserver
|
||||
COPY requirements /code/requirements
|
||||
COPY docker-requirements.txt /code
|
||||
COPY setup.cfg /code
|
||||
COPY setup.py /code
|
||||
COPY README.rst /code
|
||||
|
||||
RUN apk add --no-cache --virtual .build-deps \
|
||||
build-base \
|
||||
@ -39,11 +44,7 @@ RUN apk add --no-cache --virtual .build-deps \
|
||||
&& mkdir /install \
|
||||
&& python -m pip install --no-warn-script-location \
|
||||
--prefix=/install \
|
||||
/code --requirement /code/docker-requirements.txt \
|
||||
&& apk del --no-cache \
|
||||
.build-deps \
|
||||
&& rm -rf /var/cache/apk/* \
|
||||
&& rm -rf /tmp/*
|
||||
/code --requirement /code/docker-requirements.txt
|
||||
|
||||
FROM base
|
||||
# Copy the libraries installed via pip
|
||||
@ -54,8 +55,11 @@ COPY entrypoint.sh /entrypoint.sh
|
||||
# Use a consistent user and group ID so that linux users
|
||||
# can create a corresponding system user and set permissions
|
||||
# if desired.
|
||||
RUN addgroup -S -g 9898 pypiserver \
|
||||
&& adduser -S -u 9898 -G pypiserver pypiserver \
|
||||
RUN apk add bash \
|
||||
&& rm -rf /var/cache/apk/* \
|
||||
&& rm -rf /tmp/* \
|
||||
&& addgroup -S -g 9898 pypiserver \
|
||||
&& adduser -S -u 9898 -G pypiserver pypiserver --home /data\
|
||||
&& mkdir -p /data/packages \
|
||||
&& chmod +x /entrypoint.sh
|
||||
|
||||
|
10
entrypoint.sh
Normal file → Executable file
10
entrypoint.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@ -8,12 +8,4 @@ set -euo pipefail
|
||||
# write access to that directory
|
||||
chown -R pypiserver:pypiserver /data/packages
|
||||
|
||||
if [ "$@" = "" ]; then
|
||||
# No arguments were provided, use the default.
|
||||
echo "Set default option '/data/packages'"
|
||||
set -- " /data/packages"
|
||||
else
|
||||
# Use whatever was provided
|
||||
echo "Using custom CMD: $@"
|
||||
fi
|
||||
exec gosu pypiserver pypi-server -p "$PORT" $@
|
||||
|
Loading…
Reference in New Issue
Block a user