rust-musl-builder/examples/using-diesel/Dockerfile
Eric Kidd e50cbda169 Allow building with OpenSSL 1.0 or 1.1
It turns out that some popular libaries still have problems with OpenSSL
1.1, particularly `postgres` 0.15. So we'll build two sets of images
now.

We also explain the new image tagging scheme, and fix a bug wher the
test script didn't test the newly built image.
2019-04-27 09:21:32 -04:00

29 lines
846 B
Docker

# -*- mode: dockerfile -*-
#
# An example Dockerfile showing how to build a Rust executable using this
# image, and deploy it with a tiny Alpine Linux container.
# You can override this `--build-arg BASE_IMAGE=...` to use different
# version of Rust or OpenSSL.
ARG BASE_IMAGE=ekidd/rust-musl-builder:latest
# Our first FROM statement declares the build environment.
FROM ${BASE_IMAGE} AS builder
# Add our source code.
ADD . ./
# Fix permissions on source code.
RUN sudo chown -R rust:rust /home/rust
# Build our application.
RUN cargo build --release
# Now, we need to build our _real_ Docker container, copying in `using-diesel`.
FROM alpine:latest
RUN apk --no-cache add ca-certificates
COPY --from=builder \
/home/rust/src/target/x86_64-unknown-linux-musl/release/using-diesel \
/usr/local/bin/
CMD /usr/local/bin/using-diesel