Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
fix dockerfile build
Browse files Browse the repository at this point in the history
Fixes #25
  • Loading branch information
ReenigneArcher committed Oct 8, 2022
1 parent 3c1c657 commit 37f2ecc
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# buildstage
FROM python:2.7.18-alpine3.11 as buildstage
# syntax = docker/dockerfile:latest
FROM python:2.7.18-buster AS buildstage

# build args
ARG BUILD_VERSION
Expand All @@ -8,26 +8,41 @@ ARG GITHUB_SHA=$COMMIT
# note: BUILD_VERSION may be blank, COMMIT is also available
# note: build_plist.py uses BUILD_VERSION and GITHUB_SHA

# setup build directory
RUN mkdir /build
WORKDIR /build/
# create build dir and copy GitHub repo there
# todo - add `--link` once hadolint supports this syntax, see https://github.com/hadolint/hadolint/issues/826
COPY . /build

# copy repo
COPY . .
# set build dir
WORKDIR /build

RUN python # update pip \
-m pip --no-python-version-warning --disable-pip-version-check install --upgrade pip==20.3.4 setuptools \
&& python -m pip install --upgrade -r requirements-dev.txt # install dev requirements \
&& python ./scripts/install_requirements.py # install plugin requirements \
&& python ./scripts/build_plist.py # build plist \
&& rm -r ./scripts/ # remove scripts dir
# update packages
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
# install git -> required for pip to install from git
git=1:2.20.1* \
&& rm -rf /var/lib/apt/lists/*

# single layer deployed image
FROM scratch
# update pip
RUN python -m pip --no-python-version-warning --disable-pip-version-check install --no-cache-dir --upgrade \
pip==20.3.4 setuptools
# dev requirements not necessary for docker image, significantly speeds up build since lxml doesn't need to build

# build plugin
RUN python ./scripts/install_requirements.py \
&& python ./scripts/build_plist.py

# clean
RUN rm -rf ./scripts/ \
# list contents
# todo - why is dockerignore not being respected?
&& ls -a

FROM scratch AS deploy

# variables
ARG PLUGIN_NAME="PlexyGlass.bundle"
ARG PLUGIN_DIR="/config/Library/Application Support/Plex Media Server/Plug-ins"

# add files from buildstage
# todo - add `--link` once hadolint supports this syntax, see https://github.com/hadolint/hadolint/issues/826
COPY --from=buildstage /build/ $PLUGIN_DIR/$PLUGIN_NAME

0 comments on commit 37f2ecc

Please sign in to comment.