Skip to content

Commit

Permalink
test native gha vs docker
Browse files Browse the repository at this point in the history
  • Loading branch information
digorgonzola committed Apr 13, 2023
1 parent 378f5a9 commit 63e36e9
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Docker Build Pipeline

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Docker Image
uses: docker/build-push-action@v4
env:
BUILDER_UID: ${{ runner.uid }}
with:
context: .
file: Dockerfile.build
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: aodn-portal-build

- name: Run Pipeline Steps
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-v ${{ runner.home }}/bin:${HOME}/bin \
-w /workspace \
--entrypoint /bin/bash \
aodn-portal-build -c '
mvn -B clean test
grails -DARTIFACT_BUILD_NUMBER=${BUILD_NUMBER} -Dgrails.work.dir=${WORKSPACE}/target clean --non-interactive --plain-output
grails -DARTIFACT_BUILD_NUMBER=${BUILD_NUMBER} -Dgrails.work.dir=${WORKSPACE}/target war --non-interactive --plain-output
'
- name: Archive Artifact
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v3
with:
name: war-file
path: target/*.war
24 changes: 24 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive

ENV GRAILS_VERSION 2.4.4
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV GRAILS_HOME /usr/lib/jvm/grails
ENV PATH $GRAILS_HOME/bin:$PATH

RUN apt-get update && apt-get install -y --no-install-recommends \
git \
libxml2-utils \
maven \
openjdk-8-jdk \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/lib/jvm

RUN wget https://github.com/grails/grails-core/releases/download/v$GRAILS_VERSION/grails-$GRAILS_VERSION.zip && \
unzip grails-$GRAILS_VERSION.zip && \
rm -rf grails-$GRAILS_VERSION.zip && \
ln -s grails-$GRAILS_VERSION grails

0 comments on commit 63e36e9

Please sign in to comment.