Skip to content

Commit

Permalink
Using the slim approach instead of the GUI approach for Dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
obilodeau committed Mar 26, 2020
1 parent dba3ad9 commit 5e0ed2f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Handles compiling and package installation
FROM ubuntu:18.04 AS compile-image
# Install Dependencies
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-pip \
# Required for local pip install
python3-setuptools \
# Required for venv setup
python3-venv \
# Required to build RLE module
build-essential python3-dev
# Required to build RLE module and dbus-python
build-essential python3-dev \
libdbus-1-dev \
libdbus-glib-1-dev

RUN python3 -m venv /opt/venv
# Make sure we use the virtualenv:
Expand All @@ -21,14 +23,18 @@ COPY ext/rle.c /pyrdp/ext/rle.c
COPY pyrdp/ /pyrdp/pyrdp/
# Install in the virtualenv
RUN cd /pyrdp \
&& pip3 --no-cache-dir install . -U
&& pip3 --no-cache-dir install .[GUI] -U


# Handles runtime only (minimize size for distribution)
FROM ubuntu:18.04 AS docker-image

# Install Dependencies
# Install runtime dependencies except pre-built venv
RUN apt-get update && apt-get install -y --no-install-recommends python3 \
&& rm -rf /var/lib/apt/lists/*
# GUI and notifications stuff
libgl1-mesa-glx \
notify-osd dbus-x11 libxkbcommon-x11-0 \
&& rm -rf /var/lib/apt/lists/*

# Copy preinstalled dependencies from compile image
COPY --from=compile-image /opt/venv /opt/venv
Expand Down
22 changes: 10 additions & 12 deletions Dockerfile.gui → Dockerfile.slim
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#
# This is a slimmer version of our docker image without the graphical player
# and notification system integration.
#
# Handles compiling and package installation
FROM ubuntu:18.04 AS compile-image
# Install Dependencies
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-pip \
# Required for local pip install
python3-setuptools \
# Required for venv setup
python3-venv \
# Required to build RLE module and dbus-python
build-essential python3-dev \
libdbus-1-dev \
libdbus-glib-1-dev
# Required to build RLE module
build-essential python3-dev

RUN python3 -m venv /opt/venv
# Make sure we use the virtualenv:
Expand All @@ -23,18 +25,14 @@ COPY ext/rle.c /pyrdp/ext/rle.c
COPY pyrdp/ /pyrdp/pyrdp/
# Install in the virtualenv
RUN cd /pyrdp \
&& pip3 --no-cache-dir install .[GUI] -U

&& pip3 --no-cache-dir install . -U

# Handles runtime only (minimize size for distribution)
FROM ubuntu:18.04 AS docker-image

# Install Dependencies
# Install runtime dependencies except pre-built venv
RUN apt-get update && apt-get install -y --no-install-recommends python3 \
# GUI stuff
libgl1-mesa-glx \
notify-osd dbus-x11 libxkbcommon-x11-0 \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

# Copy preinstalled dependencies from compile image
COPY --from=compile-image /opt/venv /opt/venv
Expand Down

0 comments on commit 5e0ed2f

Please sign in to comment.