Navigation Menu

Skip to content

Commit

Permalink
Uses Linux Alpine as base image to reduce image by about 65%.
Browse files Browse the repository at this point in the history
  - Reduce image from about 413 MB to about 144 MB.
  - Changes default font (Purisa isn't easy to install on Linux Alpine).
  • Loading branch information
wernight committed Apr 19, 2016
1 parent 15d8c0e commit f77a360
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Expand Up @@ -8,3 +8,6 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_size = 2
59 changes: 34 additions & 25 deletions Dockerfile
@@ -1,41 +1,50 @@
FROM debian:jessie
FROM alpine:3.3

MAINTAINER Werner Beroux <werner@beroux.com>

COPY . /opt/scruffy-server

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
fonts-tlwg-purisa \
git \
RUN set -x \
&& apk add --update \
graphviz \
libjpeg-dev \
librsvg2-bin \
plotutils \
libjpeg \
librsvg \
python \
py-pillow \
zlib \
&& apk add -t .build-deps \
make \
g++ \
git \
python-dev \
python-pil \
python-pip \
python-setuptools \
zlib1g-dev \

&& git clone https://github.com/aivarsk/scruffy.git /opt/scruffy \
&& cd /opt/scruffy \
&& python setup.py install \
py-pip \
py-setuptools \
zlib-dev \

&& mkdir -p /usr/share/fonts/opentype/dion \
&& cd /usr/share/fonts/opentype/dion \
&& wget -O dion.zip 'http://dl.dafont.com/dl/?f=dion' \
&& unzip dion.zip \
&& rm dion.zip \
&& fc-cache -f -v \

&& wget -O- https://mirrors.kernel.org/gnu/plotutils/plotutils-2.6.tar.gz | tar -xz -C /tmp \
&& cd /tmp/plotutils-2.6 \
&& ./configure \
&& make install \
&& make installcheck \
&& cd pic2plot \
&& make install \
&& cd - \
&& rm -rf scruffy \
&& rm -rf /tmp/plotutils-2.6 \

&& cd /opt/scruffy-server \
&& pip install -r requirements.txt \

&& apt-get purge --auto-remove -y \
git \
python-dev \
python-pip \
python-setuptools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& apk del --purge .build-deps \
&& rm /var/cache/apk/* \

&& useradd --system --uid 35726 -m --shell /usr/sbin/nologin scruffy
&& adduser -S -u 35726 -s /sbin/nologin scruffy

# Run as non-root user
USER scruffy
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
@@ -1,5 +1,5 @@
bottle==0.12.8
Pillow==2.8.2
reportlab==3.2.0
bottle==0.12.9
Pillow>=2.3
reportlab==3.3.0
scruffy==0.3
svglib==0.6.3

0 comments on commit f77a360

Please sign in to comment.