Skip to content

Commit

Permalink
Merge branch 'main' into feature/clean-dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
cjyetman authored Nov 17, 2023
2 parents dae22a4 + 824b861 commit 6ffcbc9
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/.git
**/.github
**/.gitignore
**/Dockerfile
**/*.md
**/*.Rproj
44 changes: 27 additions & 17 deletions .github/workflows/build-and-push-Docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Build and push docker image

on:
workflow_call:
inputs:
Expand All @@ -10,33 +12,41 @@ on:
outputs:
full-image-name:
description: "Full pushed image name including host/registry, name, and tag"
value: ${{ jobs.docker-build.outputs.full-image-name }}
value: ${{ jobs.docker.outputs.full-image-name }}

jobs:
docker-build:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
timeout-minutes: 25
outputs:
full-image-name: ${{ steps.push-image.outputs.full-image-name }}
full-image-name: ${{ steps.image-name.outputs.full-image-name }}

steps:
- name: Checkout
# https://github.com/actions/checkout
uses: actions/checkout@v3

- name: Build Docker image
run: docker build . --file Dockerfile --tag ${{ inputs.image-name }}

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Push image
id: push-image
- name: Define image name
id: image-name
run: |
full_image_name="ghcr.io/${{ github.repository_owner }}/${{ inputs.image-name }}:${{ inputs.image-tag }}"
full_image_name=$(echo $full_image_name | tr '[A-Z]' '[a-z]')
docker tag ${{ inputs.image-name }} $full_image_name
docker push $full_image_name
echo "full-image-name=$full_image_name" >> $GITHUB_OUTPUT
echo "full-image-name=$full_image_name" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.image-name.outputs.full-image-name }}
cache-from: type=gha
cache-to: type=gha,mode=min
11 changes: 11 additions & 0 deletions .github/workflows/run-hadolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
on: [push, pull_request]

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 RMI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0 comments on commit 6ffcbc9

Please sign in to comment.