-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from eryajf/main
feat: 添加构建镜像与release的action 用 docker builder 和 frontend-maven-plugin 很难利用缓存机制,还需改成在 ubuntu 环境中构建。
- Loading branch information
Showing
7 changed files
with
171 additions
and
23 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,42 @@ | ||
# Configuration for Release Drafter: https://github.com/toolmantim/release-drafter | ||
name-template: 'v$NEXT_PATCH_VERSION 🌈' | ||
tag-template: 'v$NEXT_PATCH_VERSION' | ||
version-template: $MAJOR.$MINOR.$PATCH | ||
# Emoji reference: https://gitmoji.carloscuesta.me/ | ||
categories: | ||
- title: '🚀 Features' | ||
labels: | ||
- 'feature' | ||
- 'enhancement' | ||
- 'kind/feature' | ||
- title: '🐛 Bug Fixes' | ||
labels: | ||
- 'fix' | ||
- 'bugfix' | ||
- 'bug' | ||
- 'regression' | ||
- 'kind/bug' | ||
- title: 📝 Documentation updates | ||
labels: | ||
- 'doc' | ||
- 'documentation' | ||
- 'kind/doc' | ||
- title: 👻 Maintenance | ||
labels: | ||
- chore | ||
- dependencies | ||
- 'kind/chore' | ||
- 'kind/dep' | ||
- title: 🚦 Tests | ||
labels: | ||
- test | ||
- tests | ||
exclude-labels: | ||
- reverted | ||
- no-changelog | ||
- skip-changelog | ||
- invalid | ||
change-template: '* $TITLE (#$NUMBER) @$AUTHOR' | ||
template: | | ||
## What’s Changed | ||
$CHANGES |
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,62 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: build docker image | ||
|
||
# Controls when the action will run. | ||
on: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: [created,published] # 表示在创建新的 Release 时触发 | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
# 可以手动触发 | ||
workflow_dispatch: | ||
inputs: | ||
logLevel: | ||
description: 'Log level' | ||
required: true | ||
default: 'warning' | ||
tags: | ||
description: 'Test scenario tags' | ||
|
||
jobs: | ||
buildx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Available platforms | ||
run: echo ${{ steps.buildx.outputs.platforms }} | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
# 所需要的体系结构,可以在 Available platforms 步骤中获取所有的可用架构 | ||
platforms: linux/arm64,linux/amd64 | ||
# 镜像推送时间 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
# 给清单打上多个标签 | ||
tags: | | ||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.GITHUB_REPOSITORY_NAME_PART }}:latest | ||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.GITHUB_REPOSITORY_NAME_PART }}:${{ env.GITHUB_REF_NAME }} |
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,38 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
# branches to consider in the event; optional, defaults to all | ||
branches: | ||
- main | ||
# pull_request event is required only for autolabeler | ||
pull_request: | ||
# Only following types are handled by the action, but one can default to all as well | ||
types: [opened, reopened, synchronize] | ||
# pull_request_target event is required for autolabeler to support PRs from forks | ||
# pull_request_target: | ||
# types: [opened, reopened, synchronize] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
update_release_draft: | ||
permissions: | ||
contents: write # for release-drafter/release-drafter to create a github release | ||
pull-requests: write # for release-drafter/release-drafter to add label to PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
# (Optional) GitHub Enterprise requires GHE_HOST variable set | ||
#- name: Set GHE_HOST | ||
# run: | | ||
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV | ||
|
||
# Drafts your next Release notes as Pull Requests are merged into "master" | ||
- uses: release-drafter/release-drafter@v5 | ||
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml | ||
# with: | ||
# config-name: my-config.yml | ||
# disable-autolabeler: true | ||
env: | ||
GITHUB_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 |
---|---|---|
@@ -1,27 +1,33 @@ | ||
FROM maven:3.8.6-openjdk-11 AS builder | ||
|
||
WORKDIR /app | ||
ENV JAR_FILE="/app/server/huntly-server/target/huntly-server-*.jar" | ||
|
||
COPY app . | ||
|
||
RUN cd server \ | ||
&& mvn dependency:go-offline -B \ | ||
&& mvn clean package -DignoreSnapshots=true -Dhttps.protocols=TLSv1.2 -U \ | ||
&& mv ${JAR_FILE} /app/server.jar | ||
|
||
FROM openjdk:11 | ||
|
||
LABEL maintainer="lcomplete" | ||
LABEL version = "0.1.0" | ||
|
||
WORKDIR /app | ||
|
||
VOLUME /data | ||
|
||
RUN mkdir -p /data /data/lucene | ||
|
||
ARG JAR_FILE=./app/server/huntly-server/target/huntly-server-*.jar | ||
ARG JAR_PATH=/app/server.jar | ||
|
||
COPY ${JAR_FILE} ${JAR_PATH} | ||
RUN mkdir -p /data/lucene | ||
|
||
ENV JAR_PATH="/app/server.jar" | ||
ENV JAVA_ARGS="-Xms128m -Xmx1024m" | ||
ENV VM_ARGS="-Duser.timezone=GMT+08" | ||
ENV APP_ARGS="" | ||
ENV PROFILE="default" | ||
ENV PORT=80 | ||
ENV JAR_PATH=${JAR_PATH} | ||
|
||
EXPOSE ${PORT} | ||
EXPOSE 443 | ||
|
||
COPY --from=builder ${JAR_PATH} ${JAR_PATH} | ||
|
||
ENTRYPOINT ["sh", "-c", "java $JAVA_ARGS $VM_ARGS -jar $JAR_PATH --spring.profiles.active=$PROFILE --server.port=$PORT --huntly.dataDir=/data/ --huntly.luceneDir=/data/lucene $APP_ARGS" ] |
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
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
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