-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.run
More file actions
57 lines (39 loc) · 1.29 KB
/
Copy pathDockerfile.run
File metadata and controls
57 lines (39 loc) · 1.29 KB
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
# THIS IS USE FOR BUILDING THE IMAGE EXAMPLE PROJECT ACTIX V8
################
##### Builder
# FROM rust:1.61.0-slim as builder
FROM rust:latest as builder
RUN apt-get update -y
# RUN apt-get install -y pkg-config musl-tools
WORKDIR /usr/src
# Create blank project
# We want dependencies cached, so copy those first.
COPY Cargo.toml Cargo.lock /usr/src/run_v8/
# Now copy in the rest of the sources
COPY . /usr/src/run_v8
# Set the working directory
WORKDIR /usr/src/run_v8
## Install target platform (Cross-Compilation) --> Needed for Alpine
# RUN rustup target add x86_64-unknown-linux-musl
RUN apt-get install pkg-config
# This is the actual application build.
RUN cargo build --example=run-v8 --release
RUN echo $(ls -1)
################
##### Runtime
FROM ubuntu:20.04 AS runtime
WORKDIR /app
RUN pwd
RUN echo $(ls -1)
# Copy application binary from builder image
COPY --from=builder /usr/src/run_v8/target/release/examples/run-v8 /app
# Create a example web to run the application
RUN mkdir -p examples/simple-ssr/source/dist
COPY --from=builder /usr/src/run_v8/examples/simple-ssr/source/dist /app/examples/simple-ssr/source/dist
RUN echo $(ls ./examples/simple-ssr/source/dist)
RUN echo $(ls -1)
# exposing out base on server PORT
EXPOSE 8082
RUN "./run-v8"
# Run the application
CMD ["./run-v8"]