Skip to content

Commit

Permalink
Docker packaging and publishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
bittrance committed Oct 3, 2023
1 parent c381e4c commit 88f6392
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
test/
53 changes: 53 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: release
on:
release:
types: [published]

jobs:
image:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: Prepare
id: prep
run: |
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
VERSION=sha-${GITHUB_SHA::8}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Get GitHub Tag
id: get_tag
run: |
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Cache container layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: bittrance
password: ${{ secrets.DOCKER_SECRET }}
- name: Build and push container
uses: docker/build-push-action@v4
with:
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: bittrance/kitops:${{ steps.get_tag.outputs.tag }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM rust:1.72-buster AS builder

WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY ./src/ ./src/
RUN cargo install --path .

FROM debian:buster-slim

COPY --from=builder /app/target/release/kitops /usr/local/bin/kitops
RUN apt-get update && apt-get install -y ca-certificates openssl && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["/usr/local/bin/kitops"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The plan forward, roughly in falling priority:
- [x] specialized notification action to update github status
- [x] new git sha and branch name in action env vars
- [x] changed task config should override state loaded from disk
- [ ] docker packaging
- [x] docker packaging
- [ ] readme with design and deployment options
- [ ] intelligent gitconfig handling
- [ ] allow git commands in workdir (but note that this means two tasks can no longer point to the same repo without additional changeas)
Expand Down

0 comments on commit 88f6392

Please sign in to comment.