mirror of
https://github.com/pypiserver/pypiserver
synced 2024-11-09 16:45:51 +01:00
Use python 3.6 for the Dockerfile (#284)
* Use python 3.6 for the Dockerfile * Dockerfile: use explicit Alpine version * Empty commit to trigger a new CI build
This commit is contained in:
parent
afafd0ae50
commit
5e3d34324c
53
Dockerfile
53
Dockerfile
@ -1,48 +1,33 @@
|
||||
FROM alpine:3.8 AS base
|
||||
FROM python:3.6-alpine3.10 as base
|
||||
|
||||
# Copy the requirements & code and install them
|
||||
# Do this in a separate image in a separate directory
|
||||
# to not have all the build stuff in the final image
|
||||
FROM base AS builder
|
||||
RUN apk update
|
||||
# Needed to build cffi
|
||||
RUN apk add python-dev build-base libffi-dev
|
||||
COPY . /code
|
||||
RUN mkdir /install
|
||||
RUN pip install --no-warn-script-location \
|
||||
--prefix=/install \
|
||||
/code --requirement /code/docker-requirements.txt
|
||||
|
||||
FROM base
|
||||
|
||||
# Install python and modules that can't be installed via pip
|
||||
# Delete the uncompiled variants to shave off ~10MB of the docker file
|
||||
RUN addgroup -S -g 9898 pypiserver \
|
||||
&& adduser -S -u 9898 -G pypiserver pypiserver \
|
||||
&& mkdir -p /data/packages \
|
||||
&& chown -R pypiserver:pypiserver /data/packages \
|
||||
# Set the setgid bit so anything added here gets associated with the
|
||||
# pypiserver group
|
||||
&& chmod g+s /data/packages \
|
||||
&& apk --no-cache add python py2-bcrypt py2-cffi py2-six \
|
||||
&& find /usr -name "*.py" ! -name "__*" -exec rm {} \; \
|
||||
# Ensure pip is available to all further images
|
||||
&& apk add --no-cache py2-pip
|
||||
|
||||
FROM base as builder
|
||||
|
||||
# Copy the requirements and install them
|
||||
# Do this in a separate image in a separate directory
|
||||
# to not have all the pip stuff in the final image
|
||||
COPY docker-requirements.txt /requirements.txt
|
||||
|
||||
# Install python packages
|
||||
RUN mkdir /install \
|
||||
&& pip install --prefix=/install --requirement /requirements.txt \
|
||||
&& find /install -name "*.py" ! -name "__*" -exec rm {} \;
|
||||
|
||||
FROM base
|
||||
&& chmod g+s /data/packages
|
||||
|
||||
# Copy the libraries installed via pip
|
||||
COPY --from=builder /install /usr
|
||||
|
||||
COPY . /code
|
||||
|
||||
RUN apk add py2-setuptools \
|
||||
&& cd code \
|
||||
&& python setup.py install \
|
||||
&& cd / \
|
||||
&& rm -rf code
|
||||
|
||||
VOLUME /data/packages
|
||||
COPY --from=builder /install /usr/local
|
||||
USER pypiserver
|
||||
VOLUME /data/packages
|
||||
WORKDIR /data
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["pypi-server", "-p", "8080"]
|
||||
CMD ["packages"]
|
||||
|
@ -1 +1,2 @@
|
||||
passlib==1.7.1
|
||||
bcrypt==3.1.7
|
Loading…
Reference in New Issue
Block a user