Skip to content
Permalink
Browse files

Add .hash.json for Docker.

  • Loading branch information...
Koenkk committed Jun 15, 2018
1 parent 96191a2 commit d69111f577862e5233f728cb3cef940b89696102
Showing with 28 additions and 7 deletions.
  1. +1 βˆ’0 .dockerignore
  2. +1 βˆ’1 .gitignore
  3. +1 βˆ’1 .travis/docker.sh
  4. +5 βˆ’1 docker/Dockerfile.amd64
  5. +5 βˆ’1 docker/Dockerfile.arm32v6
  6. +5 βˆ’1 docker/Dockerfile.arm64v8
  7. +10 βˆ’2 lib/controller.js
@@ -1,5 +1,6 @@
node_modules
.travis*
.git
.gitignore
*.png
firmware
@@ -60,4 +60,4 @@ typings/
# data
data/database.db
data/config.json
data/log*.txt
data/log*.txt
@@ -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
}

@@ -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,14 +5,18 @@ 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", \
"cp /app/data/configuration.yaml /app && \
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,14 +5,18 @@ 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", \
"cp /app/data/configuration.yaml /app && \
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"]
@@ -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();
});
}

0 comments on commit d69111f

Please sign in to comment.
You can’t perform that action at this time.