-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (50 loc) · 1.76 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
#
# -------- ---------- -----
# | rust | | carbon | | C |
# -------- ---------- -----
# | | |
# | | |
FROM rust as rust
WORKDIR /usr/src/myapp
COPY ./src/lib/ .
RUN cargo build --release --all-targets --manifest-path /usr/src/myapp/Cargo.toml
# | |
# install carbon | |
# ------| |
# | | |
FROM linuxbrew/brew as brew
RUN HOMEBREW_MAKE_JOBS=8 HOMEBREW_VERBOSE=1 brew update
RUN HOMEBREW_MAKE_JOBS=8 HOMEBREW_VERBOSE=1 brew install [email protected]
RUN HOMEBREW_MAKE_JOBS=8 HOMEBREW_VERBOSE=1 brew install bazelisk
RUN HOMEBREW_MAKE_JOBS=8 HOMEBREW_VERBOSE=1 brew install llvm
# | |
# | |
# | |
# | |
FROM brew as carbon
RUN git clone https://github.com/carbon-language/carbon-lang carbon
WORKDIR /home/linuxbrew/carbon
COPY --from=rust /usr/src/myapp/target/release/librust_file_listener.so /home/linuxbrew/carbon/explorer/
SHELL ["/bin/bash", "-c"]
RUN mv -v /home/linuxbrew/carbon/explorer/BUILD /home/linuxbrew/carbon/explorer/BUILD-old
RUN touch ./explorer/BUILD
RUN sed -n '1,17p' ./explorer/BUILD-old >> ./explorer/BUILD
RUN echo ' srcs = ["main.cpp", "librust_file_listener.so"],' >> ./explorer/BUILD
RUN sed -n '19,$p' ./explorer/BUILD-old >> ./explorer/BUILD
RUN rm ./explorer/BUILD-old
RUN cp ./explorer/librust_file_listener.so .
RUN bazel build --jobs 8 --verbose_failures //explorer
COPY ./src/main.carbon .
COPY ./src/file-listener.h .
#RUN bazel run --jobs 8 //explorer -- ./main.carbon
# |
# |
# |
# |
# FROM gcc as gcc
#WORKDIR /usr/src/myapp
#COPY ./src/main.c .
#COPY ./src/file-listener.h .
#RUN gcc main.c
#FROM alpine
#COPY --from=rust /usr/src/myapp/target/release/librust_file_listener.so .