-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add docker files * add action to build docker file and publish it as a package * point to published docker image in example docker-compose.yml
- Loading branch information
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: build-and-publish-docker | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
|
||
pull_request: | ||
branches: ["master"] | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Workaround: https://github.com/docker/build-push-action/issues/461 | ||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Clean container registry | ||
uses: actions/delete-package-versions@v4 | ||
with: | ||
package-name: "elk-live" | ||
package-type: "container" | ||
min-versions-to-keep: 3 | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM alpine:latest | ||
|
||
LABEL authors="Arnd Plumhoff <[email protected]>, Sascha Hoppe <[email protected]>" | ||
|
||
ARG ELKLIVE_UID=1002 | ||
|
||
RUN apk add --update --no-cache yarn git gradle curl | ||
|
||
RUN adduser elklive -h /elklive -D -u ${ELKLIVE_UID} | ||
|
||
USER elklive | ||
|
||
RUN git clone https://github.com/kieler/elk-live --depth=1 /elklive | ||
|
||
WORKDIR "/elklive/client" | ||
RUN yarn install && yarn run build | ||
|
||
WORKDIR "/elklive/server" | ||
RUN ./gradlew build | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["./gradlew", "jettyRun", "--args='-m=SIGTERM'"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: "2" | ||
|
||
services: | ||
elkweb: | ||
container_name: elkweb | ||
image: ghcr.io/kieler/elk-live:master | ||
ports: | ||
- 8082:8080 | ||
restart: unless-stopped | ||
cpus: 0.5 | ||
mem_limit: 536870912 | ||
healthcheck: | ||
test: curl --fail http://localhost:8080 || exit 1 | ||
interval: 60s | ||
start_period: 2m |