-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.arm
executable file
·35 lines (26 loc) · 1 KB
/
Dockerfile.arm
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
FROM --platform=$BUILDPLATFORM node:18-alpine AS frontend
RUN npm i -g pnpm
RUN mkdir -p /app/
WORKDIR /app
COPY web/package*.json ./
COPY web/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY web/. .
RUN pnpm build
FROM --platform=$BUILDPLATFORM rust:slim-bookworm AS backend
WORKDIR /app
RUN rustup target add aarch64-unknown-linux-gnu
RUN apt-get update && apt-get install gcc-aarch64-linux-gnu -y
COPY ./Cargo.lock ./backend/Cargo.toml .
COPY ./backend/src ./src
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
ENV CC=aarch64-linux-gnu-gcc
RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/app/target cargo build --release --target aarch64-unknown-linux-gnu && cp ./target/aarch64-unknown-linux-gnu/release/backend .
FROM --platform=linux/arm64/v8 debian:bookworm-slim
WORKDIR /app
COPY --from=frontend /app/build /app/public
COPY --from=backend /app/backend /app/
ENV RUST_LOG=info
ENV APP_PORT=80
ENV APP_HOST=0.0.0.0
ENTRYPOINT [ "/app/backend" ]