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 bec5195
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Lint Dockerfile
uses: actions/checkout@v3

- uses: hadolint/hadolint-action@v2.1.0
- uses: hadolint/hadolint-action@v2.0.0
with:
dockerfile: ./Dockerfile

Expand Down
46 changes: 31 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,42 @@ 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
RUN ls -a
# todo - why is dockerignore not being respected?

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 bec5195

Please sign in to comment.