Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
95 lines (67 loc) · 2.23 KB
/
Copy pathDockerfile
File metadata and controls
95 lines (67 loc) · 2.23 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
FROM rust:1.89-bookworm AS rust-build
WORKDIR /usr/local/src/ferriskey
RUN cargo install sqlx-cli --no-default-features --features postgres
COPY Cargo.toml Cargo.lock ./
COPY api/Cargo.toml ./api/
COPY core/Cargo.toml ./core/
COPY operator/Cargo.toml ./operator/
RUN \
mkdir -p api/src core/src entity/src operator/src && \
echo "fn main() {}" > api/src/main.rs && \
touch core/src/lib.rs && \
echo "fn main() {}" > operator/src/main.rs && \
cargo build --release
COPY api api
COPY core core
COPY operator operator
RUN \
touch api/src/main.rs && \
touch core/src/lib.rs && \
touch operator/src/main.rs && \
cargo build --release
FROM debian:bookworm-slim AS runtime
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates=20230311+deb12u1 \
libssl3=3.0.17-1~deb12u2 && \
rm -rf /var/lib/apt/lists/* && \
addgroup \
--system \
--gid 1000 \
ferriskey && \
adduser \
--system \
--no-create-home \
--disabled-login \
--uid 1000 \
--gid 1000 \
ferriskey
USER ferriskey
FROM runtime AS api
COPY --from=rust-build /usr/local/src/ferriskey/target/release/ferriskey-server /usr/local/bin/
COPY --from=rust-build /usr/local/src/ferriskey/core/migrations /usr/local/src/ferriskey/migrations
COPY --from=rust-build /usr/local/cargo/bin/sqlx /usr/local/bin/
EXPOSE 80
ENTRYPOINT ["ferriskey-server"]
FROM runtime AS operator
COPY --from=rust-build /usr/local/src/ferriskey/target/release/ferriskey-operator /usr/local/bin/
EXPOSE 80
ENTRYPOINT ["ferriskey-operator"]
FROM node:20.14.0-alpine AS webapp-build
WORKDIR /usr/local/src/ferriskey
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN \
corepack enable && \
corepack prepare pnpm@9.15.0 --activate && \
apk --no-cache add dumb-init=1.2.5-r3
COPY front/package.json front/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY front/ .
RUN pnpm run build
FROM nginx:1.28.0-alpine3.21-slim AS webapp
COPY --from=webapp-build /usr/local/src/ferriskey/dist /usr/local/src/ferriskey
COPY front/nginx.conf /etc/nginx/conf.d/default.conf
COPY front/docker-entrypoint.sh /docker-entrypoint.d/docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.d/docker-entrypoint.sh