-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
51 lines (38 loc) · 1.21 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
# syntax=docker/dockerfile:experimental
FROM golang:1.17 as goget
COPY go.mod go.sum /go/src/github.com/octu0/blurry/
RUN set -eux && \
apt-get clean && \
apt-get update -y && \
apt-get install -y git wget openssh-client && \
cd /go/src/github.com/octu0/blurry && \
go mod download
# ----------------------------------
FROM golang:1.17 as builder
COPY --from=goget /go/bin/ /go/bin/
COPY --from=goget /go/src/ /go/src/
COPY --from=goget /go/pkg/ /go/pkg/
WORKDIR /build
RUN set -eux && \
apt-get clean && \
apt-get update -y && \
apt-get install -y gcc libc-dev libc++-dev g++ clang wget libtinfo5 libclang-dev
ADD . /go/src/github.com/octu0/blurry/
RUN set -eux && \
cd /go/src/github.com/octu0/blurry && \
GOOS=linux GOARCH=amd64 go build -o /build/blurry \
cmd/cgo/main.go \
&& \
/build/blurry --version
RUN set -eux && \
apt-get remove -y gcc libc-dev && \
apt-get purge -y && \
apt-get autoclean
# ----------------------------------
FROM golang:1.17
WORKDIR /app
COPY --from=builder /build/blurry /app
RUN set -eux && \
/app/blurry --version
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT [ "docker-entrypoint.sh" ]