Skip to content

Commit

Permalink
Simple example of starting a process in Java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
WireMock Admin authored and Mahoney committed Feb 9, 2022
0 parents commit 3e5f6a7
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Local build
**/out/

# Git
/.git/
.gitignore

# IntelliJ
/.idea/

# macOS
**/.DS_Store

# GitHub
/.github/

# Docker
Dockerfile
.dockerignore
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Multi Arch Docker Build

on:
push:

env:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
PROGRESS_NO_TRUNC: 1

jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

# Allow us to build multi-arch images
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all

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

- name: Do the build
run: docker buildx build --platform linux/arm64/v8,linux/amd64 .
Empty file added .gitignore
Empty file.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# syntax=docker/dockerfile:1.3.0-labs
FROM eclipse-temurin:17.0.2_8-jdk-focal as builder

COPY ProcessUser.java .
RUN javac ProcessUser.java
RUN java ProcessUser > /tmp/output.txt

FROM scratch
COPY --from=builder /tmp/output.txt .
10 changes: 10 additions & 0 deletions ProcessUser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import java.io.IOException;

public class ProcessUser {
public static void main(String[] args) throws IOException, InterruptedException {
new ProcessBuilder("uname", "-a")
.inheritIO()
.start()
.waitFor();
}
}

0 comments on commit 3e5f6a7

Please # to comment.