forked from convox/convox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
75 lines (45 loc) · 2.13 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
## development #################################################################
FROM golang:1.19 AS development
ARG DOCKER_ARCH=x86_64
ARG KUBECTL_ARCH=amd64
RUN apt-get update && apt-get -y install default-mysql-client postgresql-client redis-tools telnet
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -s https://download.docker.com/linux/static/stable/$DOCKER_ARCH/docker-20.10.7.tgz | \
tar -C /usr/bin --strip-components 1 -xz
RUN curl -Ls https://dl.k8s.io/release/v1.24.2/bin/linux/$KUBECTL_ARCH/kubectl -o /usr/bin/kubectl && \
chmod +x /usr/bin/kubectl
RUN curl -Ls https://github.com/mattgreen/watchexec/releases/download/1.8.6/watchexec-1.8.6-x86_64-unknown-linux-gnu.tar.gz | \
tar -C /usr/bin --strip-components 1 -xz
ENV DEVELOPMENT=true
WORKDIR /usr/src/convox
COPY go.mod go.sum ./
COPY vendor vendor
RUN go build -mod=vendor --ldflags="-s -w" $(go list -mod=vendor ./vendor/...)
COPY . .
RUN make build
## package #####################################################################
FROM golang:1.19 AS package
WORKDIR /usr/src/convox
COPY . .
RUN make package build compress
## production ##################################################################
FROM ubuntu:22.04
ARG DOCKER_ARCH=x86_64
ARG KUBECTL_ARCH=amd64
RUN apt-get -qq update && apt-get -qq -y install curl default-mysql-client postgresql-client redis-tools telnet skopeo
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -s https://download.docker.com/linux/static/stable/$DOCKER_ARCH/docker-20.10.7.tgz | \
tar -C /usr/bin --strip-components 1 -xz
RUN curl -Ls https://storage.googleapis.com/kubernetes-release/release/v1.22.15/bin/linux/$KUBECTL_ARCH/kubectl -o /usr/bin/kubectl && \
chmod +x /usr/bin/kubectl
ENV DEVELOPMENT=false
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:$PATH
WORKDIR /app
COPY --from=package /go/bin/api $GOPATH/bin/
COPY --from=package /go/bin/atom $GOPATH/bin/
COPY --from=package /go/bin/build $GOPATH/bin/
COPY --from=package /go/bin/convox $GOPATH/bin/
COPY --from=package /go/bin/docs $GOPATH/bin/
COPY --from=package /go/bin/resolver $GOPATH/bin/
COPY --from=package /usr/src/convox/bin/docs bin/docs