Skip to content

Instantly share code, notes, and snippets.

@nnao45
Last active May 15, 2019 01:42
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 nnao45/099eb1855b88bacc2253b8fc0c2f5fd5 to your computer and use it in GitHub Desktop.
Save nnao45/099eb1855b88bacc2253b8fc0c2f5fd5 to your computer and use it in GitHub Desktop.
# Setup Building Container
## Install Dependency Module
FROM rust:1.34.1-slim as builder
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu \
OPENSSL_INCLUDE_DIR=/usr/include/openssl \
RUST_VERSION=%%RUST-VERSION%%
RUN set -eux; \
apt-get update && \
apt-get install -y --no-install-recommends \
git \
libssl-dev
## Build Cache Dependency Library
RUN mkdir /twiquery-stream
COPY Cargo.toml Cargo.lock /twiquery-stream/
WORKDIR /twiquery-stream
RUN mkdir -p src/ && \
touch src/lib.rs
RUN cargo build --release
## Build Base Library
COPY . .
RUN cargo build --release
# Setup Running Container
## Install Dependency Module
FROM debian:9.9-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y \
ca-certificates \
tzdata
RUN cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
echo "Asia/Tokyo" > /etc/timezone
## Copy App
COPY --from=builder /twiquery-stream/target/release/twiquery-stream .
## Run
CMD ["./twiquery-stream"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment