This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
forked from ultimate-guitar/reImage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (51 loc) · 2.03 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FROM alpine:edge AS mozjpeg
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk add --no-cache alpine-sdk nasm autoconf automake libtool pkgconfig
RUN adduser -s /bin/sh -D -G abuild abuild
RUN echo "%abuild ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/abuild
USER abuild
RUN abuild-keygen -a -i -n -q
# Buildind mozjpeg and installing it
WORKDIR /tmp/mozjpeg
COPY --chown=abuild:abuild alpine/mozjpeg/APKBUILD ./
RUN sudo chown abuild:abuild ./
RUN abuild -r -i || abuild -r -i
# Building tiff and installing it
WORKDIR /tmp/tiff
COPY --chown=abuild:abuild alpine/tiff/* ./
RUN sudo chown abuild:abuild ./
RUN abuild -r -i || abuild -r -i
# Building lcms2 and installing it
WORKDIR /tmp/lcms2
COPY --chown=abuild:abuild alpine/lcms2/* ./
RUN sudo chown abuild:abuild ./
RUN abuild -r -i || abuild -r -i
# Building libvips
WORKDIR /tmp/vips
COPY --chown=abuild:abuild alpine/vips/APKBUILD ./
RUN sudo chown abuild:abuild ./
RUN abuild -r || abuild -r
# Building reImage
FROM alpine:edge AS go
WORKDIR /go/src/reImage
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
COPY --from=mozjpeg /home/abuild/packages/tmp/x86_64/*.apk /tmp/
RUN apk add --allow-untrusted /tmp/*.apk && apk add --no-cache go git fftw-dev musl-dev dep
ENV GOPATH /go
RUN go get github.com/ultimate-guitar/go-imagequant
COPY Gopkg.* ./
COPY *.go ./
RUN dep ensure
RUN go build -o reImage *.go
# Create Release image without dev dependencies
FROM alpine:edge AS release
WORKDIR /usr/local/bin/
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
COPY --from=mozjpeg /home/abuild/packages/tmp/x86_64/mozjpeg*.apk /tmp/
COPY --from=mozjpeg /home/abuild/packages/tmp/x86_64/vips*.apk /tmp/
COPY --from=mozjpeg /home/abuild/packages/tmp/x86_64/lcms2*.apk /tmp/
COPY --from=mozjpeg /home/abuild/packages/tmp/x86_64/tiff*.apk /tmp/
RUN apk add --allow-untrusted /tmp/*.apk && apk add --no-cache ca-certificates
COPY --from=go /go/src/reImage/reImage .
ENV CFG_LISTEN ":7075"
CMD ["./reImage"]