Skip to content

Commit

Permalink
Merge pull request #1 from iLert/feature/add-docker-release
Browse files Browse the repository at this point in the history
add dockerfile and action for docker release
  • Loading branch information
krystianity authored Nov 2, 2021
2 parents bc9409d + 414a574 commit 1ee25cf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: docker-release

on:
release:
types:
- published

jobs:
deploy:
if: "!github.event.release.prerelease"
name: Build and publish to docker hub
runs-on: ubuntu-latest
timeout-minutes: 10

env:
SERVICE_NAME: ilagent
REGISTRY: ilert

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build, tag, and push image
id: build-image
env:
IMAGE_TAG_1: ${{ github.sha }}
IMAGE_TAG_2: ${{ github.event.release.tag_name }}
run: |
docker build -t ${REGISTRY}/${SERVICE_NAME}:${IMAGE_TAG_1} -t ${REGISTRY}/${SERVICE_NAME}:${IMAGE_TAG_2} -t ${REGISTRY}/${SERVICE_NAME}:latest .
docker push ${REGISTRY}/${SERVICE_NAME}:${IMAGE_TAG_1}
docker push ${REGISTRY}/${SERVICE_NAME}:${IMAGE_TAG_2}
docker push ${REGISTRY}/${SERVICE_NAME}:latest
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM rust:1.56 AS builder
WORKDIR /usr/src/ilagent
COPY . .
RUN cargo install --path .

FROM alpine
COPY --from=builder /usr/local/cargo/bin/ilagent /usr/local/bin/ilagent
CMD ["ilagent"]

0 comments on commit 1ee25cf

Please sign in to comment.