mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-17 02:48:31 -07:00
e0a6b7d348
* Add possibility to override execution command at runtime The entrypoint script initialize container data at runtime. CMD defines the default executable and can be overridden at runtime. * Set execution permission to entrypoint script Necessary to prevent run errors, for example in windows env
34 lines
698 B
Docker
34 lines
698 B
Docker
FROM node:12-alpine as base
|
|
|
|
WORKDIR /app
|
|
RUN apk add --no-cache tzdata eudev
|
|
|
|
COPY package.json ./
|
|
|
|
# Dependencies
|
|
FROM base as dependencies
|
|
|
|
COPY npm-shrinkwrap.json ./
|
|
|
|
RUN apk add --no-cache --virtual .buildtools make gcc g++ python linux-headers git && \
|
|
npm ci --production && \
|
|
apk del .buildtools
|
|
|
|
# Release
|
|
FROM base as release
|
|
|
|
COPY --from=dependencies /app/node_modules ./node_modules
|
|
COPY lib ./lib
|
|
COPY index.js data/configuration.yaml ./
|
|
|
|
COPY docker/docker-entrypoint.sh /usr/local/bin/
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
RUN mkdir /app/data
|
|
|
|
ARG COMMIT
|
|
RUN echo "{\"hash\": \"$COMMIT\"}" > .hash.json
|
|
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
CMD ["npm", "start"]
|