2019-12-24 06:36:32 +01:00
|
|
|
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
|
2015-10-26 23:58:03 +01:00
|
|
|
|
2019-01-30 09:20:58 +01:00
|
|
|
RUN addgroup -S -g 9898 pypiserver \
|
|
|
|
&& adduser -S -u 9898 -G pypiserver pypiserver \
|
|
|
|
&& mkdir -p /data/packages \
|
|
|
|
&& chown -R pypiserver:pypiserver /data/packages \
|
2018-06-27 03:51:32 +02:00
|
|
|
# Set the setgid bit so anything added here gets associated with the
|
|
|
|
# pypiserver group
|
2019-12-24 06:36:32 +01:00
|
|
|
&& chmod g+s /data/packages
|
2019-01-30 09:20:58 +01:00
|
|
|
|
|
|
|
# Copy the libraries installed via pip
|
2019-12-24 06:36:32 +01:00
|
|
|
COPY --from=builder /install /usr/local
|
2018-06-27 03:51:32 +02:00
|
|
|
USER pypiserver
|
2019-12-24 06:36:32 +01:00
|
|
|
VOLUME /data/packages
|
2015-10-26 23:58:03 +01:00
|
|
|
WORKDIR /data
|
2018-06-27 03:51:32 +02:00
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["pypi-server", "-p", "8080"]
|
|
|
|
CMD ["packages"]
|