-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
61 lines (46 loc) · 1.24 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
FROM golang:alpine AS builder
RUN set -ex && \
apk add --no-cache gcc musl-dev
# Set necessary environmet variables needed for our image
ENV GO111MODULE=on \
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
SPINUP_PROJECT_DIR=/tmp/spinuplocal \
ARCHITECTURE=amd64 \
CF_AUTHORIZATION_TOKEN=replaceme \
CF_ZONE_ID=replaceme \
CLIENT_ID=replaceme \
CLIENT_SECRET=replaceme
# Move to working directory /build
WORKDIR /build
# Copy and download dependency using go mod
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy the code into the container
COPY . .
# Build the application
RUN go build -o main .
# Move to /dist directory as the place for resulting binary folder
WORKDIR /dist
# Copy binary from build to main folder
RUN cp /build/main .
# Build a small image
FROM docker/compose
COPY --from=builder /dist/main /
RUN mkdir /tmp/spinuplocal
# Set necessary environmet variables needed for our image
ENV GO111MODULE=on \
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
SPINUP_PROJECT_DIR=/tmp/spinuplocal \
ARCHITECTURE=amd64 \
CF_AUTHORIZATION_TOKEN=replaceme \
CF_ZONE_ID=replaceme \
CLIENT_ID=replaceme \
CLIENT_SECRET=replaceme
EXPOSE 4434
# Command to run
ENTRYPOINT ["/main"]