Skip to content

Commit

Permalink
Dockerfile and container github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvigneshwars committed May 17, 2024
1 parent 622f456 commit fff255e
Show file tree
Hide file tree
Showing 5 changed files with 2,713 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Container

on:
push:
pull_request:

jobs:
build:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
services:
ispyb:
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0
ports:
- 3306:3306
env:
MARIADB_ROOT_PASSWORD: rootpassword
options: >
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect"
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/[email protected]

- name: Generate Image Name
run: echo IMAGE_REPOSITORY=ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV

- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.IMAGE_REPOSITORY }}
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
driver-opts: network=host

- name: Build Image
uses: docker/[email protected]
with:
build-args: DATABASE_URL=mysql://root:rootpassword@localhost:3306/ispyb_build
target: deploy
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
load: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ ca.crt
config_argus
# vcluster config
kubeconfig.yaml
/target
Loading

0 comments on commit fff255e

Please sign in to comment.