-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
49 lines (30 loc) · 959 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
48
49
FROM golang:1.16 AS build_go
#RUN apk add --no-cache git
# Set the Current Working Directory inside the container
WORKDIR /tmp/etcd-adminer/api
# We want to populate the module cache based on the go.{mod,sum} files.
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
# unit tests
RUN go test -v
# build the binary
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o etcd-adminer-linux-amd64 .
# Build the UI
FROM node:latest AS build_ui
WORKDIR /tmp/etcd-adminer/ui
COPY ["./ui/package.json", "./ui/package-lock.json", "./"]
RUN ls
RUN npm install --production
COPY ./ui .
RUN npm run build
# Start fresh from a smaller image
FROM alpine:3.9
RUN apk add ca-certificates
COPY --from=build_go /tmp/etcd-adminer/api/etcd-adminer-linux-amd64 /app/etcd-adminer-linux-amd64
COPY config.default.yaml /app/config.yaml
COPY --from=build_ui /tmp/etcd-adminer/ui/build /app/static
WORKDIR /app
EXPOSE 8080
CMD ["/app/etcd-adminer-linux-amd64"]