From 5683366b70231d73a00e549699a81d75e5476c91 Mon Sep 17 00:00:00 2001 From: Supanat Pothivarakorn Date: Sat, 18 May 2019 18:57:59 +0700 Subject: [PATCH] Update docker deployment --- .travis.yml | 11 ++++++++++- Dockerfile | 20 ++++++++++++++++---- docker_push | 8 ++++++++ 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100755 docker_push diff --git a/.travis.yml b/.travis.yml index 613564f..9b81502 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1 +1,10 @@ -language: rust \ No newline at end of file +language: rust + +services: + - docker + +deploy: + provider: script + script: bash docker_push + on: + branch: master diff --git a/Dockerfile b/Dockerfile index e4ffc91..89fa60c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,19 @@ -FROM rust:1.33 +FROM rust:1.34.2 as build -WORKDIR /usr/src/app +# create a new empty shell project +RUN USER=root cargo new --bin ficon +WORKDIR /app -RUN cargo install ficon +COPY . /app -CMD ["ficon"] +RUN cargo build --release +RUN rm src/*.rs + +# our final base +FROM debian:stretch-slim + +# copy the build artifact from the build stage +COPY --from=build /app/target/release/ficon . + +# set the startup command to run your binary +CMD ["./ficon"] diff --git a/docker_push b/docker_push new file mode 100755 index 0000000..9d2b11c --- /dev/null +++ b/docker_push @@ -0,0 +1,8 @@ +#!/bin/bash + +echo "building docker image..." + +docker build -t ibosz/ficon . + +echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_HUB_USERNAME" --password-stdin +docker push ibosz/ficon