Last active
April 27, 2020 11:24
-
-
Save gdamjan/ef3be348fbbb2b03790eb5d09d5c285c to your computer and use it in GitHub Desktop.
ubuntu 20.04 + rustyd base docker image (https://github.com/KillingSpark/rustysd)
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
FROM rust:1-alpine as rust-builder | |
### Compile a static binary of rustysd | |
ARG RUSTYSD_VER=v0.2.0 | |
WORKDIR /src | |
RUN rustup target add x86_64-unknown-linux-musl && \ | |
wget https://github.com/KillingSpark/rustysd/archive/${RUSTYSD_VER}.tar.gz && \ | |
tar xf ${RUSTYSD_VER}.tar.gz -C /src --strip-components=1 | |
RUN cargo build --target x86_64-unknown-linux-musl --release | |
RUN strip --strip-unneeded \ | |
target/x86_64-unknown-linux-musl/release/rustysd \ | |
target/x86_64-unknown-linux-musl/release/rsdctl | |
### Now, once rustysd is compiled, just copy it to a base ubuntu:20.04 image | |
### thus getting a base image that you can just add apps and .service files to run | |
FROM ubuntu:20.04 | |
COPY --from=rust-builder /src/target/x86_64-unknown-linux-musl/release/rustysd /src/target/x86_64-unknown-linux-musl/release/rsdctl /rustysd/ | |
COPY --from=rust-builder /src/test_units/default.target /src/test_units/sockets.target /rustysd/unitfiles/ | |
COPY rustysd_config.toml /rustysd/rustysd_config.toml | |
ENTRYPOINT ["/rustysd/rustysd", "-c", "/rustysd/"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example usage
you write your own unit for a service:
and then just create a docker image for the service based of this one and copy the unit in the proper place. The service will be started by rustysd when the image is started: