-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
38 lines (29 loc) · 1.21 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
FROM rust:1.66.0-slim-bullseye as builder
WORKDIR /root
COPY src /root/src
COPY Cargo.toml /root
COPY Cargo.lock /root
COPY wrangler.toml /root
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates build-essential libssl-dev pkg-config \
&& cargo install [email protected] \
&& cargo install [email protected] \
&& sed -i 's/command =.*$/command="true"/' wrangler.toml \
&& worker-build --release \
&& mkdir /root/node \
&& curl --silent --show-error https://nodejs.org/dist/v18.13.0/node-v18.13.0-linux-x64.tar.xz \
| tar --strip-components=1 -x -J -C /root/node -f -
FROM debian:bullseye-20230109-slim
RUN groupadd -r nonroot \
&& useradd -m -r -g nonroot nonroot
COPY --chown=nonroot docker-entrypoint.sh package*.json /home/nonroot/
COPY --chown=nonroot .wrangler/ /home/nonroot/.wrangler/
COPY --from=builder --chown=nonroot /root/build/ /home/nonroot/build/
COPY --from=builder --chown=nonroot /root/wrangler.toml /home/nonroot/
COPY --from=builder --chown=nonroot /root/node/ /home/nonroot/node/
USER nonroot
WORKDIR /home/nonroot
env PATH=$PATH:/home/nonroot/node/bin
RUN npm install
EXPOSE 8787
ENTRYPOINT ["/home/nonroot/docker-entrypoint.sh"]