Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/5 years of technical debt #2

Merged
merged 9 commits into from Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
63 changes: 63 additions & 0 deletions .devcontainer/devcontainer.json
@@ -0,0 +1,63 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/java
{
"name": "Java",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/java:1-17-bullseye",

"features": {
// "ghcr.io/devcontainers/features/java:1": {
// "installMaven": true,
// "version": "17",
// "jdkDistro": "ms",
// "mavenVersion": "latest"
// },
"ghcr.io/devcontainers/features/java:1": {
"installMaven": true,
"version": "17",
"jdkDistro": "amzn",
"mavenVersion": "latest"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"moby": true,
"installDockerBuildx": true,
"installDockerComposeSwitch": true,
"version": "latest",
"dockerDashComposeVersion": "latest"
}
},
"containerEnv": {
"JAVA_HOME": "/usr/local/sdkman/candidates/java/current/",
"TESTCONTAINERS_RYUK_DISABLED": "true"
},
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"java.jdt.ls.java.home": "/usr/local/sdkman/candidates/java/current/"
},
"extensions": [
"ms-azuretools.vscode-docker",
"redhat.fabric8-analytics",
"vscjava.vscode-java-pack",
"DotJoshJohnson.xml"
]
}
},
"mounts": [
"source=${localEnv:HOME}/.m2,target=/home/vscode/.m2,type=bind,consistency=cached"
]


// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
43 changes: 43 additions & 0 deletions .github/workflows/maven.yml
@@ -0,0 +1,43 @@
#
# Copyright 2021 The original authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 'Check out repository'
uses: actions/checkout@v4
with:
submodules: 'true'

- name: 'Set up Java'
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'corretto'
cache: 'maven'

- name: 'Build example service'
run: mvn -B clean verify
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,5 +1,8 @@
.classpath
.project
.settings
.idea
.vscode
target
.DS_Store
.flattened-pom.xml
33 changes: 33 additions & 0 deletions Dockerfile
@@ -0,0 +1,33 @@
FROM amazoncorretto:17-alpine

# Default payara ports to expose
EXPOSE 6900 8080

# Configure environment variables
ENV PAYARA_HOME=/opt/payara\
DEPLOY_DIR=/opt/payara/deployments

# Create and set the Payara user and working directory owned by the new user
RUN addgroup payara && \
adduser -D -h ${PAYARA_HOME} -H -s /bin/bash payara -G payara && \
echo payara:payara | chpasswd && \
mkdir -p ${DEPLOY_DIR} && \
chown -R payara:payara ${PAYARA_HOME}
USER payara
WORKDIR ${PAYARA_HOME}

# Download specific
ARG PAYARA_VERSION="6.2024.2"
ENV PAYARA_VERSION="$PAYARA_VERSION"
RUN wget --no-verbose -O ${PAYARA_HOME}/payara-micro.jar https://repo1.maven.org/maven2/fish/payara/extras/payara-micro/${PAYARA_VERSION}/payara-micro-${PAYARA_VERSION}.jar

# Copy in the war
COPY target/experiments.war ${DEPLOY_DIR}/

# Default command to run
ENV JAVA_OPTS=""
ENV PAYARA_OPTS=""

# Default command to run
# ENTRYPOINT ["java", "-XX:+UseContainerSupport", "-XX:MaxRAMPercentage=90.0", "-jar", "payara-micro.jar", "--deploymentDir", "/opt/payara/deployments"]
ENTRYPOINT java -XX:+UseContainerSupport -XX:MaxRAMPercentage=90.0 ${JAVA_OPTS} -jar payara-micro.jar --deploymentDir "/opt/payara/deployments" ${PAYARA_OPTS}