-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (39 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
59 lines (39 loc) · 1.11 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
FROM node:22-alpine AS portal-builder
WORKDIR /build/portal
COPY portal/package.json portal/pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile
COPY portal/ ./
RUN pnpm build
FROM ghcr.io/rust-cross/cargo-zigbuild:latest AS builder
ARG VERSION
ARG TARGET
ARG ARCH
ENV VERSION=${VERSION}
ENV TARGET=${TARGET}
ENV ARCH=${ARCH}
ENV PKG_CONFIG_ALL_STATIC=1
ENV PKG_CONFIG_SYSROOT_DIR=/
ENV ac_cv_func_malloc_0_nonnull=yes
SHELL ["/bin/bash", "-c"]
RUN apt-get update && apt-get install -y \
build-essential \
wget \
pkg-config \
ca-certificates \
flex \
bison \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY Cargo.toml Cargo.toml
RUN mkdir src && echo "fn main(){}" > src/main.rs
RUN rustup target add ${TARGET}
RUN cargo zigbuild --release --target ${TARGET} || true
COPY ./src ./src
COPY ./build.rs ./build.rs
COPY --from=portal-builder /build/portal/build ./portal/build
RUN cargo zigbuild --release --target ${TARGET}
RUN mkdir /out && \
cp target/${TARGET}/release/dockless \
/out/dockless-${VERSION}-linux-${ARCH}
FROM scratch
COPY --from=builder /out /