-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
53 lines (35 loc) · 1.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
FROM golang:1.23-alpine AS dependencies
LABEL MAINTAINER="Tomas Novotny <tomas.novotny@inspirum.cz>"
RUN apk add --no-cache \
git \
curl \
tar
WORKDIR /tmp/svgcleaner
RUN curl -fsL "https://github.com/RazrFalcon/svgcleaner-gui/releases/download/v0.9.5/svgcleaner_linux_x86_64_0.9.5.tar.gz" | tar -xz \
&& chmod +x svgcleaner \
&& mv svgcleaner /usr/bin/svgcleaner \
&& rm -rf /tmp/svgcleaner
WORKDIR /tmp/build
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build -o ./out/resizer ./app
FROM alpine as base
LABEL MAINTAINER="Tomas Novotny <tomas.novotny@inspirum.cz>"
ENV STORAGE_LOCAL_PREFIX=/var/www/cache/
RUN apk add --no-cache \
imagemagick \
pngquant \
jpegoptim \
gifsicle \
libwebp-tools \
file && \
mkdir -p /var/www/cache
COPY --from=dependencies /usr/bin/svgcleaner /usr/bin/svgcleaner
WORKDIR /var/www/
COPY --from=dependencies /tmp/build/out/resizer .
COPY ./app/static ./static
ENV PORT=3000
EXPOSE $PORT
ENTRYPOINT "/var/www/resizer"