Skip to content

Commit

Permalink
refix
Browse files Browse the repository at this point in the history
  • Loading branch information
nnao45 committed Jul 11, 2019
1 parent 2d99712 commit 9b4cda8
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ FROM ekidd/rust-musl-builder:nightly-2019-04-25 as builder
ENV LINUX_TERM_LIB linux_musl.rs

## Build Cache Dependency Library
RUN mkdir /app
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/app/target \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/usr/local/cargo/registry \
cargo build --release -Z unstable-options --out-dir /output
RUN mkdir /tmp/dntk
RUN sudo chown -R rust:rust .
WORKDIR /tmp/dntk
COPY Cargo.toml Cargo.lock ./
RUN mkdir -p src/ && \
touch src/lib.rs
RUN cargo build --release
## Build Base Library
COPY ./src/ ./src/
RUN sudo chown -R rust:rust .
RUN cargo build --release

# Setup Running Container
FROM alpine:3.9
Expand All @@ -21,7 +24,7 @@ RUN adduser --uid 1000 -D nnao45
## Install Dependency Module
RUN apk add --update --no-cache bc
## Copy The App
COPY --from=builder /output/dntk /home/nnao45
COPY --from=builder /tmp/dntk/target/x86_64-unknown-linux-musl/release/dntk /home/nnao45
## Setup The Using App User
USER 1000:1000
## Run
Expand Down

0 comments on commit 9b4cda8

Please sign in to comment.