Skip to content
This repository has been archived by the owner on Nov 23, 2018. It is now read-only.

Commit

Permalink
Merge pull request #40 from pressly/sane_build
Browse files Browse the repository at this point in the history
Restore sanity to the build process
  • Loading branch information
pkieltyka authored Dec 4, 2017
2 parents 6c4bb07 + 88dae6f commit 641520a
Showing 1 changed file with 25 additions and 38 deletions.
63 changes: 25 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,31 @@
FROM golang:1.9

# Dependencies
RUN apt-get update && apt-get install --no-install-recommends -y build-essential \
zlib1g-dev pkg-config

# Install libturbo-jpeg
ADD https://sourceforge.net/projects/libjpeg-turbo/files/1.5.2/libjpeg-turbo-official_1.5.2_amd64.deb/download /tmp/libjpeg-turbo-official_1.5.2_amd64.deb
RUN cd /tmp && dpkg -i /tmp/libjpeg-turbo-official_1.5.2_amd64.deb && \
echo /opt/libjpeg-turbo/lib64 > /etc/ld.so.conf.d/libjpeg-turbo.conf && ldconfig

# Install libpng
ADD https://sourceforge.net/projects/libpng/files/libpng16/1.6.32/libpng-1.6.32.tar.gz/download /tmp/libpng-1.6.32.tar.gz
RUN cd /tmp && tar -zxvf libpng-1.6.32.tar.gz && cd libpng-1.6.32 && \
./configure --prefix=/usr && make && make install && ldconfig

# Install ImageMagick v7
ADD https://www.imagemagick.org/download/ImageMagick-7.0.7-0.tar.xz /tmp/
RUN cd /tmp && tar -xvf ImageMagick-7.0.7-0.tar.xz && cd ImageMagick-7.0.7-0 && \
./configure --prefix=/usr \
--enable-shared \
--disable-openmp \
--disable-opencl \
--without-x \
--with-quantum-depth=8 \
--with-magick-plus-plus=no \
--with-jpeg=yes \
--with-png=yes \
--with-jp2=yes \
LIBS="-ljpeg -lturbojpeg" \
LDFLAGS="-L/opt/libjpeg-turbo/lib64" \
CFLAGS="-I/opt/libjpeg-turbo/include" \
CPPFLAGS="-I/opt/libjpeg-turbo/include" \
&& make && make install && ldconfig

# Imgry
FROM golang:1.9-alpine3.6 as builder

RUN apk add --no-cache \
libpng \
libjpeg-turbo \
imagemagick \
make \
gcc \
musl-dev \
libpng-dev \
libjpeg-turbo-dev \
imagemagick-dev

ADD . /go/src/github.com/pressly/imgry
WORKDIR /go/src/github.com/pressly/imgry
RUN make dist
RUN mv bin/imgry-server /bin/imgry-server


FROM alpine:3.6

RUN apk add --no-cache \
libpng \
libjpeg-turbo \
imagemagick \
ca-certificates

COPY --from=builder /go/src/github.com/pressly/imgry/bin/imgry-server /bin/imgry-server

EXPOSE 4446

CMD ["/bin/imgry-server", "-config=/etc/imgry.conf"]
CMD ["/bin/imgry-server", "-config=/imgry.conf"]

0 comments on commit 641520a

Please sign in to comment.