-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
49 lines (28 loc) · 1.33 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
# ------------------------------------------------------------------------------
# Cargo Build Stage
# ------------------------------------------------------------------------------
FROM rust:latest as cargo-build
#RUN apt-get update && apt-get install libssl-dev -y && rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/import-ynab
COPY Cargo.toml Cargo.lock ./
RUN mkdir src/
RUN echo "#[cfg(test)] fn main() {println!(\"if you see this, the build broke\")}" > src/lib.rs
RUN cargo build --release
RUN rm -f target/release/deps/import-ynab* src/lib.rs
COPY . .
RUN touch src/lib.rs
RUN cargo build --release --offline
# ------------------------------------------------------------------------------
# Final Stage
# ------------------------------------------------------------------------------
FROM ubuntu:rolling
LABEL org.opencontainers.image.source=https://github.com/LunNova/import-ynab
RUN addgroup --gid 1000 import-ynab && \
adduser --disabled-login --shell /bin/sh --uid 1000 --ingroup import-ynab import-ynab && \
apt-get update && apt-get install libssl3 libcurl4 -y && rm -rf /var/lib/apt/lists/*
WORKDIR /home/import-ynab/
COPY --from=cargo-build /usr/src/import-ynab/target/release/import-ynab import-ynab
RUN chown import-ynab:import-ynab import-ynab
USER import-ynab
VOLUME /home/import-ynab/secrets/
CMD ["./import-ynab"]