forked from itaylor/docker-vhoster
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
...but docker can't write to /etc/hosts file... AARGH!
- Loading branch information
Showing
4 changed files
with
282 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
FROM rust:1.59 as BUILD | ||
|
||
ARG RUSTFLAGS='-C link-arg=-s' | ||
ARG TARGET='x86_64-unknown-linux-musl' | ||
|
||
RUN USER=root cargo new --bin docker-vhoster | ||
WORKDIR /docker-vhoster | ||
|
||
# copy over your manifests | ||
COPY ./Cargo.toml ./Cargo.toml | ||
|
||
# this build step will cache your dependencies | ||
RUN cargo build --release && rm src/*.rs | ||
ENV RUSTFLAGS=${RUSTFLAGS} | ||
# cache deps | ||
RUN rustup target add ${TARGET} && cargo build --release --target ${TARGET} && rm src/*.rs | ||
COPY ./src /docker-vhoster/src | ||
RUN cargo build --release --bin | ||
# build as a statically linked library | ||
RUN cargo build --release --target ${TARGET} --bin docker-vhoster | ||
#RUN ls -alh /docker-vhoster/target/${TARGET} && exit 1 | ||
|
||
# our final base | ||
FROM debian:bullseye-slim | ||
# copy the build artifact from the build stage | ||
COPY --from=BUILD docker-vhoster . | ||
# set the startup command to run your binary | ||
CMD ["./docker-vhoster"] | ||
FROM scratch | ||
ARG TARGET='x86_64-unknown-linux-musl' | ||
COPY --from=BUILD /docker-vhoster/target/${TARGET}/release/docker-vhoster / | ||
CMD ["/docker-vhoster"] |
Oops, something went wrong.