Skip to content

Commit

Permalink
make and push docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
AEnterprise committed Oct 14, 2020
1 parent 589a457 commit 7c247df
Show file tree
Hide file tree
Showing 6 changed files with 1,339 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!./src
!Cargo.toml
!Cargo.lock
79 changes: 79 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
on:
push:
branches:
- 'main'

name: Build

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v1
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-test-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
github_artifact:
name: Github Artifact
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout sources
uses: actions/checkout@v1
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-release-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
- name: Create release build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: upload artifact
uses: actions/upload-artifact@v1
with:
name: GearBot_API
path: target/release/gearbot_api
docker_container:
name: Create Docker Container
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout sources
uses: actions/checkout@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: aenterprise
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Docker image
run: |
docker build -t gearbot/gearbot_api:latest .
- name: Push container to Docker Hub
run: |
docker push gearbot/gearbot_api:latest
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# will have compiled files and executables
/target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
Loading

0 comments on commit 7c247df

Please sign in to comment.