123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- ARG BASE_IMAGE=docker.io/alpine:3.13.1
- ARG SOURCE_DIR_PATH=/systemctl-mqtt
- FROM $BASE_IMAGE as build
- RUN apk add --no-cache \
- cairo-dev `
- dbus-dev \
- gcc \
- git `
- glib-dev `
- gobject-introspection-dev `
- jq `
- make `
- musl-dev `
- py3-certifi `
- py3-pip `
- py3-virtualenv `
- python3-dev `
- && adduser -S build
- USER build
- RUN pip3 install --user --no-cache-dir pipenv==2021.5.29
- ARG SOURCE_DIR_PATH
- COPY --chown=build:nobody Pipfile Pipfile.lock $SOURCE_DIR_PATH/
- WORKDIR $SOURCE_DIR_PATH
- ENV PIPENV_CACHE_DIR=/tmp/pipenv-cache \
- PIPENV_VENV_IN_PROJECT=yes-please \
- PATH=/home/build/.local/bin:$PATH
- RUN jq 'del(.default."systemctl-mqtt", .default."sanitized-package")' Pipfile.lock > Pipfile.lock~ \
- && mv Pipfile.lock~ Pipfile.lock \
- && pipenv install --deploy --verbose
- COPY --chown=build:nobody . $SOURCE_DIR_PATH
- RUN pipenv install --deploy --verbose \
- && pipenv graph \
- && pipenv run pip freeze \
- && rm -rf .git/ $PIPENV_CACHE_DIR \
- && chmod -cR a+rX .
- USER 0
- RUN chown -R 0:0 $SOURCE_DIR_PATH
- USER build
- FROM $BASE_IMAGE
- RUN apk add --no-cache \
- ca-certificates \
- dbus-libs \
- glib `
- gobject-introspection `
- python3 \
- tini \
- && find / -xdev -type f -perm /u+s -exec chmod -c u-s {} \; \
- && find / -xdev -type f -perm /g+s -exec chmod -c g-s {} \;
- USER nobody
- ARG SOURCE_DIR_PATH
- COPY --from=build $SOURCE_DIR_PATH $SOURCE_DIR_PATH
- ARG VIRTUALENV_PATH=$SOURCE_DIR_PATH/.venv
- ENV PATH=$VIRTUALENV_PATH/bin:$PATH
- ENTRYPOINT ["tini", "--"]
- CMD ["systemctl-mqtt", "--help"]
|