File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111FROM eclipse-temurin:24-jre-alpine
1212LABEL org.opencontainers.image.authors="yanglb <dev@yanglb.com>"
1313
14- COPY ./target/code-generator-*-jar-with-dependencies .jar /usr/local/lib/cg/bin/cg.jar
14+ COPY ./cg .jar /usr/local/lib/cg/bin/cg.jar
1515COPY ./cg /usr/local/bin/cg
1616
1717CMD [ "cg" ]
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Build Script for cg project.
4+ # Author: me@yanglb.com
5+ # Date: 2026/10/26
6+
7+ set -euo pipefail
8+
9+ function printUsage {
10+ echo " Build cg docker image."
11+ echo " Usage: ./build-docker.sh [TAG] [options]"
12+ echo " "
13+ echo " TAG image version default is latest"
14+ echo " "
15+ echo " Options"
16+ echo " -h --help Print usage."
17+ }
18+
19+ TAG=${1:- " latest" }
20+ if [ $TAG = ' -h' ] || [ $TAG = ' --help' ]; then
21+ printUsage
22+ exit 0
23+ fi
24+
25+ echo " Build docker image for yanglibing/code-generator:${TAG} "
26+
27+ # build docker
28+ docker buildx build . \
29+ --tag yanglibing/code-generator:${TAG} \
30+ --provenance=false \
31+ --output type=docker \
32+ --platform linux/amd64,linux/arm64
33+
34+ # publish
35+ docker push yanglibing/code-generator:${TAG}
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ PROJECT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
6+ POM=" $PROJECT_DIR /pom.xml"
7+ VERSION=" $( mvn -q -f " $POM " -DforceStdout help:evaluate -Dexpression=project.version) "
8+ JAR=" $PROJECT_DIR /target/code-generator-$VERSION -jar-with-dependencies.jar"
9+
10+ if [ -z " $VERSION " ]; then
11+ echo " Could not determine project version from pom.xml." >&2
12+ exit 1
13+ fi
14+
15+ echo " Building project..."
16+ mvn -f " $POM " clean package
17+
18+ if [ ! -f " $JAR " ]; then
19+ echo " Expected build artifact not found: $JAR " >&2
20+ exit 1
21+ fi
22+
23+ cp " $JAR " " $PROJECT_DIR /cg.jar"
24+ echo " Built ${JAR##*/ } and copied it to cg.jar."
You can’t perform that action at this time.
0 commit comments