-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (31 loc) · 870 Bytes
/
Dockerfile
File metadata and controls
37 lines (31 loc) · 870 Bytes
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
FROM golang:1.11.0 as build
ENV GO111MODULE=on
ENV MAX_SIZE=20
WORKDIR /go/src/github.com/AlphaWong/html2pdf
COPY . .
RUN go fmt ./...
RUN CGO_ENABLE=0 GOOS=linux \
go build \
-tags netgo \
-installsuffix netgo,cgo \
-v -a \
-ldflags '-s -w -extldflags "-static"' \
-o app
RUN apt-get -qq update && apt-get -qq install wget xz-utils
RUN wget -P /tmp/ https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz
RUN tar xvf /tmp/upx-3.95-amd64_linux.tar.xz -C /tmp
RUN mv /tmp/upx-3.95-amd64_linux/upx /go/bin
RUN upx --ultra-brute -qq app && \
upx -t app && \
mv ./app /go/bin/app
FROM gcr.io/google-appengine/debian9:2018-08-09-115606
ENV MAX_SIZE=20
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
COPY --from=build /go/bin/app /
COPY ./build.sh .
RUN mkdir /pdf
RUN sh ./build.sh
RUN wkhtmltopdf --version
EXPOSE 80
CMD ["/app"]