Skip to content

Commit

Permalink
WIP rename to tomcat webapp boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
gipo355 committed May 29, 2024
1 parent 9a9d6d0 commit e7b0c49
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 11 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
80 changes: 80 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish Docker Image Workflow
on:
release:
types: [published]
workflow_dispatch: {}
jobs:
publish-docker:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: read
packages: write
name: Publish release Job
steps:
- name: Checkout latest code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- uses: ./.github/actions/ci-setup
name: Setup CI environment
- name: Publish artifact Step
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# for com.vanniktech.maven.publish.SonatypeHost
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_PRIVATE }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASSWORD }}
run: |
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3 | cut -d "v" -f2-) # 1.0.0-dev.1
echo "New version: ${NEW_VERSION}"
echo "Github username: ${GITHUB_ACTOR}"
./gradlew -Pversion=${NEW_VERSION} publishAndReleaseToMavenCentral --no-configuration-cache
./gradlew -Pversion=${NEW_VERSION} publishAllPublicationsToGitHubPackagesRepository
steps:
- name: Checkout latest code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Setup CI environment
uses: ./.github/actions/ci-setup
# build and deploy
- name: Build project
run: ./gradlew war
# prepare tags
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/gipo999/webapp-boilerplate
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
## DOCKER BUILD AND PUSH to GHCR
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,windows/amd64
push: true
# tags: ghcr.io/${{ github.repository_owner }}/its-battistar-express:latest
tags: ${{ steps.meta.outputs.tags }}, ghcr.io/${{ github.repository_owner }}/wepapp-boilerplate:latest
labels: ${{ steps.meta.outputs.labels }}
4 changes: 2 additions & 2 deletions compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
services:
webapp-boilerplate:
tomcat-webapp-boilerplate:
# environment:
# image: tomcat:9-jdk21-temurin-jammy
build:
dockerfile: ./docker/tomcat.Dockerfile
container_name: webapp-boilerplate
container_name: tomcat-webapp-boilerplate
develop:
watch:
- action: sync+restart
Expand Down
12 changes: 6 additions & 6 deletions docker/builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ FROM eclipse-temurin:21

# create a user to run the app to prevent filesystem access conflicts

RUN addgroup --system webapp-boilerplate && \
adduser --system -G webapp-boilerplate webapp-boilerplate
RUN addgroup --system tomcat-webapp-boilerplate && \
adduser --system -G tomcat-webapp-boilerplate tomcat-webapp-boilerplate

RUN mkdir -p /home/webapp-boilerplate
RUN mkdir -p /home/tomcat-webapp-boilerplate

COPY . /home/webapp-boilerplate
COPY . /home/tomcat-webapp-boilerplate
RUN chown -R its-battistar-be-go:its-battistar-be-go .


WORKDIR /home/webapp-boilerplate
WORKDIR /home/tomcat-webapp-boilerplate

USER webapp-boilerplate
USER tomcat-webapp-boilerplate

# RUN ./gradlew war

Expand Down
4 changes: 2 additions & 2 deletions http/queries.http
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
GET http://localhost:8080/webapp-boilerplate/app/base
GET http://localhost:8080/tomcat-webapp-boilerplate/app/base

---
POST http://localhost:8080/webapp-boilerplate/app/base/health
POST http://localhost:8080/tomcat-webapp-boilerplate/app/base/health
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

rootProject.name = 'webapp-boilerplate'
rootProject.name = 'tomcat-webapp-boilerplate'

0 comments on commit e7b0c49

Please sign in to comment.