Improve build process

This commit is contained in:
R. Miles McCain 2020-05-03 10:41:14 -04:00
parent 9fe79c9f23
commit 364ec655a0
No known key found for this signature in database
GPG Key ID: 24F9B6A2588C5408

View File

@ -1,9 +1,12 @@
FROM python:3-alpine FROM python:3-alpine
# Getting things ready
WORKDIR /usr/src/shynet WORKDIR /usr/src/shynet
COPY Pipfile.lock Pipfile ./ COPY Pipfile.lock Pipfile ./
COPY shynet .
# Install dependencies & configure machine
ARG GF_UID="500"
ARG GF_GID="500"
RUN apk update && \ RUN apk update && \
apk add gettext curl bash && \ apk add gettext curl bash && \
# URL from https://github.com/shlinkio/shlink/issues/596 :) # URL from https://github.com/shlinkio/shlink/issues/596 :)
@ -17,17 +20,16 @@ RUN apk update && \
pipenv install --system --deploy && \ pipenv install --system --deploy && \
apk --purge del .build-deps && \ apk --purge del .build-deps && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
rm /var/cache/apk/* rm /var/cache/apk/* && \
ARG GF_UID="500"
ARG GF_GID="500"
# add group & user
RUN python manage.py collectstatic --noinput && \
python manage.py compilemessages && \
addgroup --system -g $GF_GID appgroup && \ addgroup --system -g $GF_GID appgroup && \
adduser appuser --system --uid $GF_UID -G appgroup adduser appuser --system --uid $GF_UID -G appgroup
# Install Shynet
COPY shynet .
RUN python manage.py collectstatic --noinput && \
python manage.py compilemessages
# Launch
USER appuser USER appuser
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT [ "./entrypoint.sh" ] ENTRYPOINT [ "./entrypoint.sh" ]