version_number

This commit is contained in:
ahmed531998 2023-08-29 13:27:11 +02:00
parent 49430d634c
commit ddf88821e7
3 changed files with 12 additions and 1 deletions

View File

@ -14,6 +14,9 @@ RUN rm -fr /root/.cache/*
COPY ./src ./src COPY ./src ./src
COPY ./public ./public COPY ./public ./public
ARG version_info
ENV REACT_APP_VERSION_INFO=${version_info}
RUN npm run build RUN npm run build
COPY . . COPY . .

5
Jenkinsfile vendored
View File

@ -18,7 +18,10 @@ pipeline {
stage('Building image') { stage('Building image') {
steps{ steps{
script { script {
dockerImage = docker.build imagename commit=$(git rev-parse --short HEAD)
date=$(date '+%Y%m%d%H%M%S')
version_info="$date-$commit"
dockerImage = docker.build(imagename, "--build-arg version_info=$version_info")
} }
} }
} }

View File

@ -17,6 +17,11 @@ const ChatPage = () => {
const [stat, setStat] = useState("start"); const [stat, setStat] = useState("start");
const [err, setErr] = useState(""); const [err, setErr] = useState("");
const version = process.env.REACT_APP_VERSION_INFO;
if (!version) {
console.info("No version information present at build time.");
}else{console.info('version: ${version}');}
useEffect(() => { useEffect(() => {
if (stat === "waiting"){ if (stat === "waiting"){