Add .hash.json for Docker.

This commit is contained in:
Koenkk
2018-06-16 00:10:08 +02:00
parent 96191a2836
commit d69111f577
7 changed files with 28 additions and 7 deletions
+1
View File
@@ -1,5 +1,6 @@
node_modules
.travis*
.git
.gitignore
*.png
firmware
+1 -1
View File
@@ -60,4 +60,4 @@ typings/
# data
data/database.db
data/config.json
data/log*.txt
data/log*.txt
+1 -1
View File
@@ -5,7 +5,7 @@ login() {
}
build_and_push() {
docker build -t $DOCKER_USERNAME/zigbee2mqtt:$1 -f $2 .
docker build --build-arg COMMIT=$(git rev-parse --short HEAD) -t $DOCKER_USERNAME/zigbee2mqtt:$1 -f $2 .
docker push $DOCKER_USERNAME/zigbee2mqtt:$1
}
+5 -1
View File
@@ -7,10 +7,14 @@ RUN cp /app/docker/run.sh /app
RUN chmod +x /app/run.sh
WORKDIR /app
# Write .hash.json
ARG COMMIT
RUN echo "{\"hash\": \"$COMMIT\"}" > .hash.json
# Install dependencies
RUN apk add --update --no-cache make gcc g++ python linux-headers udev nodejs git && \
npm install --unsafe-perm && \
apk del make gcc g++ python linux-headers udev
apk del make gcc g++ python linux-headers udev git
# Entrypoint
ENTRYPOINT ["./run.sh"]
+5 -1
View File
@@ -5,6 +5,10 @@ ENV QEMU_EXECVE 1
COPY docker/qemu-arm-static /usr/bin
WORKDIR /app
# Write .hash.json
ARG COMMIT
RUN echo "{\"hash\": \"$COMMIT\"}" > .hash.json
# Copy files & install dependencies
ADD . /app
RUN [ "qemu-arm-static", "/bin/sh", "-c", \
@@ -12,7 +16,7 @@ RUN [ "qemu-arm-static", "/bin/sh", "-c", \
cp /app/docker/run.sh /app && chmod +x /app/run.sh && \
apk add --update --no-cache make gcc g++ python linux-headers udev nodejs git && \
npm install --unsafe-perm && \
apk del make gcc g++ python linux-headers udev"]
apk del make gcc g++ python linux-headers udev git"]
# Entrypoint
ENTRYPOINT ["./run.sh"]
+5 -1
View File
@@ -5,6 +5,10 @@ ENV QEMU_EXECVE 1
COPY docker/qemu-aarch64-static /usr/bin
WORKDIR /app
# Write .hash.json
ARG COMMIT
RUN echo "{\"hash\": \"$COMMIT\"}" > .hash.json
# Copy files & install dependencies
ADD . /app
RUN [ "qemu-aarch64-static", "/bin/sh", "-c", \
@@ -12,7 +16,7 @@ RUN [ "qemu-aarch64-static", "/bin/sh", "-c", \
cp /app/docker/run.sh /app && chmod +x /app/run.sh && \
apk add --update --no-cache make gcc g++ python linux-headers udev nodejs git && \
npm install --unsafe-perm && \
apk del make gcc g++ python linux-headers udev"]
apk del make gcc g++ python linux-headers udev git"]
# Entrypoint
ENTRYPOINT ["./run.sh"]
+10 -2
View File
@@ -529,12 +529,20 @@ class Controller {
const version = packageJSON.version;
git.getLastCommit((err, commit) => {
let commitHash = null;
if (err) {
logger.info(`Starting zigbee2mqtt version ${version}`);
try {
commitHash = require('../.hash.json').hash;
} catch (error) {
commitHash = 'unknown';
}
} else {
logger.info(`Starting zigbee2mqtt version ${version} (commit ${commit.shortHash})`);
commitHash = commit.shortHash;
}
logger.info(`Starting zigbee2mqtt version ${version} (commit #${commitHash})`);
callback();
});
}