This repository has been archived by the owner on Dec 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
55 lines (41 loc) · 1.67 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
FROM ubuntu:20.04 AS build-env
RUN \
apt-get update && \
apt-get -y install --no-install-recommends ca-certificates curl gcc zlib1g-dev libstdc++-9-dev llvm-10 llvm-10-dev && \
apt-get clean
ENV LLVM_SYS_10_PREFIX /usr/lib/llvm-10
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.53.0 --profile=minimal
ENV PATH "/root/.cargo/bin:${PATH}"
# These are the minimum required files for `cargo fetch`
# This allows the `cargo fetch` to be cached between other source code changes
ADD Cargo.toml Cargo.lock /opt/arret/
ADD syntax/Cargo.toml /opt/arret/syntax/
ADD runtime/Cargo.toml /opt/arret/runtime/
ADD runtime-syntax/Cargo.toml /opt/arret/runtime-syntax/
ADD rfi-derive/Cargo.toml /opt/arret/rfi-derive/
ADD stdlib/rust/Cargo.toml /opt/arret/stdlib/rust/
ADD compiler/Cargo.toml /opt/arret/compiler/
ADD driver/Cargo.toml /opt/arret/driver/
ADD lsp-server/Cargo.toml /opt/arret/lsp-server/
WORKDIR /opt/arret
RUN cargo fetch
ADD . /opt/arret
###
FROM build-env as full-compiler
RUN cargo build --release
###
FROM ubuntu:20.04 AS repl
ARG vcs_ref
COPY --from=full-compiler /opt/arret/.arret-root /opt/arret/.arret-root
COPY --from=full-compiler /opt/arret/stdlib/arret /opt/arret/stdlib/arret
COPY --from=full-compiler /opt/arret/target/release/arret /opt/arret/target/release/arret
COPY --from=full-compiler /opt/arret/target/release/*.so /opt/arret/target/release/
RUN groupadd arret && useradd -r -g arret arret
USER arret:arret
WORKDIR /opt/arret
ENTRYPOINT ["/opt/arret/target/release/arret"]
CMD ["repl"]
# Label the commit that was used to build this
LABEL \
org.label-schema.vcs-ref=$vcs_ref \
org.label-schema.vcs-url="https://github.com/etaoins/arret"