1
0
Fork 0
mirror of https://github.com/icewind1991/clipboard-sync synced 2026-06-03 18:34:07 +02:00

use two step dockerfile

This commit is contained in:
Robin Appelman 2019-06-15 13:53:24 +02:00
commit 96295ac0dc
3 changed files with 15 additions and 11 deletions

3
.dockerignore Normal file
View file

@ -0,0 +1,3 @@
target
.git
Dockerfile

View file

@ -1,6 +1,17 @@
FROM ekidd/rust-musl-builder AS build
RUN sudo apt-get update && sudo apt-get install -y xorg-dev python3
# We need to add the source code to the image because `rust-musl-builder`
# assumes a UID of 1000, but TravisCI has switched to 2000.
ADD . ./
RUN sudo chown -R rust:rust .
RUN cargo build --release --bin server
FROM scratch FROM scratch
ADD target/x86_64-unknown-linux-musl/release/server / COPY --from=build /home/rust/src/target/x86_64-unknown-linux-musl/release/server /
EXPOSE 80 EXPOSE 80
CMD ["/server"] CMD ["/server"]

View file

@ -1,10 +0,0 @@
FROM ekidd/rust-musl-builder
RUN sudo apt-get update && sudo apt-get install -y xorg-dev python3
# We need to add the source code to the image because `rust-musl-builder`
# assumes a UID of 1000, but TravisCI has switched to 2000.
ADD . ./
RUN sudo chown -R rust:rust .
CMD cargo build --release