forked from jonathanmorley/oktaws
-
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.
- Loading branch information
Morley, Jonathan
committed
Oct 23, 2018
1 parent
5cefcbb
commit 949516c
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# We need to use the Rust build image, because | ||
# we need the Rust compile and Cargo tooling | ||
FROM clux/muslrust:stable as build | ||
|
||
# Install cmake as it is not included in muslrust, but is needed by libssh2-sys | ||
RUN apt-get update && apt-get install -y \ | ||
cmake \ | ||
--no-install-recommends && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /app | ||
# Creates a dummy project used to grab dependencies | ||
RUN USER=root cargo init --bin | ||
|
||
# Copies over *only* your manifests | ||
COPY ./Cargo.* ./ | ||
|
||
# Builds your dependencies and removes the | ||
# fake source code from the dummy project | ||
RUN cargo build --release | ||
RUN rm src/*.rs | ||
RUN rm target/x86_64-unknown-linux-musl/release/oktaws | ||
|
||
# Copies only your actual source code to | ||
# avoid invalidating the cache at all | ||
COPY ./src ./src | ||
|
||
# Builds again, this time it'll just be | ||
# your actual source files being built | ||
RUN cargo build --release | ||
|
||
FROM alpine:latest as certs | ||
RUN apk --update add ca-certificates | ||
|
||
# Create a new stage with a minimal image | ||
# because we already have a binary built | ||
FROM alpine:latest | ||
|
||
# Copies standard SSL certs from the "build" stage | ||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
|
||
# Copies the binary from the "build" stage | ||
COPY --from=build /app/target/x86_64-unknown-linux-musl/release/oktaws /bin/ | ||
|
||
# Configures the startup! | ||
ENTRYPOINT ["/bin/oktaws"] |
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