-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.dev
35 lines (27 loc) · 1.04 KB
/
Dockerfile.dev
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 node:alpine AS frontend
WORKDIR /usr/src/app
COPY static static
COPY *.js *.json ./
RUN --mount=type=cache,target=node_modules,id=magicentry-node-modules \
npm install --include=dev
RUN npm run build
FROM rust AS builder
WORKDIR /usr/src/app
RUN cargo init --vcs none --bin
COPY Cargo.toml Cargo.lock ./
COPY .cargo .cargo
RUN --mount=type=cache,target=/usr/local/cargo/git,id=magicentry-cargo-git-cache \
--mount=type=cache,target=/usr/local/cargo/registry,id=magicentry-cargo-registry-cache \
--mount=type=cache,target=/usr/src/app/target,id=magicentry-cargo-target-cache \
cargo build && \
rm target/debug/deps/magicentry*
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/git,id=magicentry-cargo-git-cache \
--mount=type=cache,target=/usr/local/cargo/registry,id=magicentry-cargo-registry-cache \
--mount=type=cache,target=/usr/src/app/target,id=magicentry-cargo-target-cache \
cargo build && \
cp target/debug/magicentry /usr/local/bin/
ENV CONFIG_FILE=/config.yaml
ENV RUST_LOG=info
EXPOSE 8080/tcp
CMD ["/usr/local/bin/magicentry"]