Skip to content

Commit

Permalink
Add initial Dockerfile and CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pathob committed Apr 29, 2021
1 parent 6fcc51d commit 67d0ca1
Show file tree
Hide file tree
Showing 6 changed files with 101 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 @@
.git/
.github/
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: build

on:
workflow_dispatch: {} # allow workflow to be run manually
push:
branches: [ main ]
release:
types: [ published ]

jobs:

build:

name: Build Image

runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v2

# - run: echo ::set-env name=IMAGE_TAG::${GITHUB_REF:10}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

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

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

- name: Build
id: build
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name == 'release' }}
tags: |
ghcr.io/${{ github.repository_owner }}/mapi:latest
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM maven:3-openjdk-11-slim

ENV DEPENDENCY="org.apache.maven.plugins:maven-dependency-plugin:3.1.2"

ADD . /

# try to download as much dependencies as possible during build

RUN mvn package -B
RUN mvn ${DEPENDENCY}:go-offline -B
RUN mvn ${DEPENDENCY}:get -Dartifact=${DEPENDENCY}:jar -B
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# docker-mapi
Maven Atlassian Plugin Installer
================================

Usage: Start the Docker container and run the `./download.sh` script as follows:

```
./download.sh <MAVEN_ARTIFACT_ID> <OUTPUT_DIRECTORY>
```

The script will download the artifact without version to the output directory. E.g.:

```
./download.sh de.aservo:confapi-crowd-plugin:0.0.8:jar ./plugins
```

This will result in:

```
$ ls ./plugins
confapi-crowd-plugin.jar
```
9 changes: 9 additions & 0 deletions download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

ARTIFACT=$1
OUTPUT=$2

DEPENDENCY="org.apache.maven.plugins:maven-dependency-plugin:3.1.2"

mvn $DEPENDENCY:get -Dartifact=$ARTIFACT -Dtransitive=false -B
mvn $DEPENDENCY:copy -Dartifact=$ARTIFACT -DoutputDirectory=$OUTPUT -Dmdep.stripVersion=true -B
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>de.aservo</groupId>
<artifactId>stub</artifactId>
<version>0.0.0</version>

</project>

0 comments on commit 67d0ca1

Please sign in to comment.