Skip to content

Instantly share code, notes, and snippets.

@Freaky
Last active April 7, 2019 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Freaky/6806ddd7d50252908e0f73e616384b58 to your computer and use it in GitHub Desktop.
Save Freaky/6806ddd7d50252908e0f73e616384b58 to your computer and use it in GitHub Desktop.
tarssh Dockerfile
FROM rust:1.33-stretch as build
WORKDIR /usr/src/tarssh
# Make a blank project with our deps for Docker to cache.
# We skip rusty-sandbox because it does nothing useful on Linux.
COPY Cargo.toml Cargo.lock .
RUN mkdir -p src \
&& echo 'fn main() { }' >src/main.rs \
&& cargo build --release --no-default-features --features drop_privs
# Copy in the full project and build
COPY . .
RUN cargo build --release --no-default-features --features drop_privs
# Use a fairly minimal enviroment for deployment
FROM debian:stretch-slim
COPY --from=build /usr/src/tarssh/target/release/tarssh /opt/tarssh
EXPOSE 22
ENTRYPOINT [ "/opt/tarssh" ]
CMD [ "-v", "--user=nobody", "--chroot=/var/empty", "-l 0.0.0.0:22 [::]:22" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment