Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
flounderpinto committed Dec 12, 2023
1 parent 47c3db0 commit 9f187c7
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/workflow-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
push:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Docker build branch
run: make docker
if: ${{ github.ref_type == 'branch' }}

- name: Docker build main
run: make docker ARGS="-t latest"
if: ${{ github.ref_type == 'branch' && github.ref_name == 'main' }}

- name: Docker build tag
run: make docker ARGS="-t ${{github.ref_name}}"
if: ${{ github.ref_type == 'tag' }}
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

CONTAINER_CODE_DIR=/opt/code

#TODO - registry var needs to move elsewhere. Builder?
DOCKER_REGISTRY=index.docker.io/flounder5
DOCKER_REPO=builder-bash
DOCKER_BUILD_CMD=dockerBuildStandard -e ${DOCKER_REGISTRY} -r ${DOCKER_REPO} ${ARGS}
#TODO
DOCKER_BUILDER_IMAGE=flounder5/builder-docker:v0.0.4
DOCKER_BUILDER_PULL_CMD=docker pull ${DOCKER_BUILDER_IMAGE}
DOCKER_BUILDER_RUN_CMD=${DOCKER_BUILDER_PULL_CMD} && \
docker run \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ${HOME}/.docker:/tmp/.docker:ro \
-v ${ROOT_DIR}:${CONTAINER_CODE_DIR} \
${DOCKER_BUILDER_IMAGE}

.PHONY: docker

docker:
${DOCKER_BUILDER_RUN_CMD} ${DOCKER_BUILD_CMD}

#Everything right of the pipe is order-only prerequisites.
all: | docker
8 changes: 8 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#TODO
FROM flounder5/runner-bash:3bc95641187ab116fad9f5695f827b48c9d0ca23

RUN apt-get update && \
apt-get install -y \
shellcheck && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

0 comments on commit 9f187c7

Please sign in to comment.