forked from bblfsh/bash-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
80 lines (54 loc) · 1.74 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
76
77
78
79
80
# Prerequisites:
# dep ensure --vendor-only
# bblfsh-sdk release
#==============================
# Stage 1: Native Driver Build
#==============================
FROM openjdk:8-slim as native
# install build dependencies
RUN apt-get update && apt-get install -y make bash wget gradle
ADD native /native
WORKDIR /native
# build native driver
RUN make
RUN gradle shadowJar
#================================
# Stage 1.1: Native Driver Tests
#================================
FROM native as native_test
# run native driver tests
RUN gradle test --info --stacktrace
#=================================
# Stage 2: Go Driver Server Build
#=================================
FROM golang:1.10-alpine as driver
ENV DRIVER_REPO=github.com/bblfsh/bash-driver
ENV DRIVER_REPO_PATH=/go/src/$DRIVER_REPO
ADD vendor $DRIVER_REPO_PATH/vendor
ADD driver $DRIVER_REPO_PATH/driver
WORKDIR $DRIVER_REPO_PATH/
# build server binary
RUN go build -o /tmp/driver ./driver/main.go
# build tests
RUN go test -c -o /tmp/fixtures.test ./driver/fixtures/
#=======================
# Stage 3: Driver Build
#=======================
FROM openjdk:8-jre-alpine
LABEL maintainer="source{d}" \
bblfsh.language="bash"
WORKDIR /opt/driver
# copy static files from driver source directory
ADD ./native/src/main/sh/native.sh ./bin/native
# copy build artifacts for native driver
COPY --from=native /native/build/libs/native-jar-with-dependencies.jar ./bin/
# copy driver server binary
COPY --from=driver /tmp/driver ./bin/
# copy tests binary
COPY --from=driver /tmp/fixtures.test ./bin/
# move stuff to make tests work
RUN ln -s /opt/driver ../build
VOLUME /opt/fixtures
# copy driver manifest and static files
ADD .manifest.release.toml ./etc/manifest.toml
ENTRYPOINT ["/opt/driver/bin/driver"]