forked from stefanmcshane/porter-agent
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
47 lines (35 loc) · 1005 Bytes
/
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
# syntax=docker/dockerfile:1.1.7-experimental
# Base Go environment
# -------------------
FROM golang:1.18-alpine as base
WORKDIR /porter
RUN apk update && apk add --no-cache gcc musl-dev git protoc
COPY go.mod go.sum ./
RUN go mod download
COPY main.go ./
COPY /api ./api
COPY /cli ./cli
COPY /internal ./internal
COPY /pkg ./pkg
COPY /migrate ./migrate
# Go build environment
# --------------------
FROM base AS build-go
# build proto files
ARG version=production
RUN go build -a -o ./bin/agent .
RUN go build -a -o ./bin/agent-cli ./cli
RUN go build -a -o ./bin/migrate ./migrate
# Deployment environment
# ----------------------
FROM alpine
RUN apk update && apk add --no-cache curl
COPY --from=build-go /porter/bin/agent /porter/
COPY --from=build-go /porter/bin/agent-cli /porter/
COPY --from=build-go /porter/bin/migrate /porter/
ENV SERVER_PORT=10001
ENV SERVER_TIMEOUT_READ=5s
ENV SERVER_TIMEOUT_WRITE=10s
ENV SERVER_TIMEOUT_IDLE=15s
EXPOSE 10001
CMD /porter/migrate && /porter/agent