forked from getsentry/sentry-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
27 lines (21 loc) · 894 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
ARG BUILD_ARCH=x86_64
FROM getsentry/rust-musl-cross:$BUILD_ARCH-musl AS sentry-build
ARG BUILD_ARCH
ENV BUILD_TARGET=$BUILD_ARCH-unknown-linux-musl
WORKDIR /work
# Build only dependencies to speed up subsequent builds
ADD Cargo.toml Cargo.lock build.rs ./
RUN mkdir -p src \
&& echo "fn main() {}" > src/main.rs \
&& cargo build --release --target=$BUILD_TARGET --locked
# Add all sources and rebuild the actual sentry-cli
ADD src src/
RUN touch src/main.rs && cargo build --target=$BUILD_TARGET --release --features managed
# Copy the compiled binary to a target-independent location so it can be picked up later
RUN cp target/$BUILD_TARGET/release/sentry-cli /usr/local/bin/sentry-cli
FROM alpine:3.7
WORKDIR /work
RUN apk add --no-cache ca-certificates
COPY ./docker-entrypoint.sh /
COPY --from=sentry-build /usr/local/bin/sentry-cli /bin
ENTRYPOINT ["/docker-entrypoint.sh"]