-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (38 loc) · 1.15 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
######
# Build Client
####################
FROM node:14.17.0-buster as client
#RUN apk update && apk --no-cache --virtual build-dependencies add make git bash python3 gcc g++
RUN apt-get update && apt-get install chromium -y
# build package manifest layer
RUN mkdir -p /ratel/client
WORKDIR /ratel/client
COPY ./client/package.json /ratel/client
RUN npm install --legacy-peer-deps
# copy all assets and build
COPY . /ratel
RUN npm run build:prod
######
# Build Server
####################
FROM golang:1.16.4-alpine as server
RUN apk update && apk add git bash
COPY . /ratel
WORKDIR /ratel
ENV CGO_ENABLED=0
COPY --from=client /ratel/client/build /ratel/client/build
# instal go-bindata
RUN go get -u github.com/go-bindata/go-bindata/...
RUN ./scripts/build.prod.sh --server
######
# Final Image
####################
FROM alpine:latest as final
RUN apk add --no-cache ca-certificates
RUN addgroup -g 1000 dgraph && \
adduser -u 1000 -G dgraph -s /bin/sh -D dgraph
# copy server artifact w/ embedded client artifact (bindata) to final stage
COPY --from=server /ratel/build/ratel /usr/local/bin/dgraph-ratel
EXPOSE 8000
USER dgraph
CMD ["/usr/local/bin/dgraph-ratel"]