-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
42 lines (27 loc) · 1.05 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
# Use Rust official image as the base image
FROM rust:1.67 as build
# Set the working directory to /app
WORKDIR /app
# Copy the Rust project files to the container
COPY . .
# Build the project with Cargo
RUN cargo build --release
RUN ls -la /app/target/release/
# Create a new image with only the built executable
FROM ubuntu:20.04
# Install OpenSSL libraries
RUN apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/*
# Set the working directory to /app
WORKDIR /app
# Copy the built executable from the previous image
COPY --from=build /app/target/release/rust_connectivity .
# Copy src files from previous image
COPY --from=build /app/src/* src/
# Copy serialised data to be used by app
COPY --from=build /app/serialised_data/* serialised_data/
# Set calls to API running in background: an attempt to force caching of loaded files
COPY --from=build /app/call_api_each_year.sh call_api_each_year.sh
RUN chmod +x call_api_each_year.sh
RUN ./call_api_each_year.sh &
# Set the command to run the Actix Web server
CMD ["./rust_connectivity"]