Skip to content

Commit

Permalink
Merge pull request #4 from LANsible/dev
Browse files Browse the repository at this point in the history
Refactor to total static without shell
  • Loading branch information
wilmardo authored Jan 20, 2020
2 parents 3e2a869 + 5b3841e commit 40bf71a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include:
- remote: https://raw.githubusercontent.com/LANsible/gitlab-includes/master/sast-cis-benchmark.yml

stages:
- lint
- build
- test
- push
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ ARG ARCHITECTURE
#######################################################################################################################
# Nexe packaging of binary
#######################################################################################################################
FROM lansible/nexe:master-${ARCHITECTURE} as builder
FROM lansible/nexe:4.0.0-beta.3-${ARCHITECTURE} as builder

ENV VERSION=dev
ENV VERSION=1.9.0

# Add unprivileged user
RUN echo "zigbee2mqtt:x:1000:1000:zigbee2mqtt:/:" > /etc_passwd
# Add to dailout as secondary group (20)
RUN echo "dailout:x:20:zigbee2mqtt" > /etc_group

# eudev: needed for udevadm binary
RUN apk --no-cache add \
Expand Down Expand Up @@ -41,6 +43,7 @@ LABEL org.label-schema.description="Zigbee2MQTT as single binary in a scratch co

# Copy the unprivileged user
COPY --from=builder /etc_passwd /etc/passwd
COPY --from=builder /etc_group /etc/group

# Serialport is using the udevadm binary
COPY --from=builder /bin/udevadm /bin/udevadm
Expand Down
15 changes: 10 additions & 5 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Zigbee2MQTT
# Zigbee2MQTT from scratch!
[![Build Status](https://cloud.drone.io/api/badges/LANsible/docker-zigbee2mqtt/status.svg)](https://cloud.drone.io/LANsible/docker-zigbee2mqtt)
[![Docker Pulls](https://img.shields.io/docker/pulls/lansible/zigbee2mqtt.svg)](https://hub.docker.com/r/lansible/zigbee2mqtt)
[![Docker Version](https://images.microbadger.com/badges/version/lansible/zigbee2mqtt:latest.svg)](https://microbadger.com/images/lansible/zigbee2mqtt:latest)
Expand All @@ -8,6 +8,8 @@

It does not work on Kubernetes with a configmap since it tries to create the database.db, state.json etc in the directory where the config is mounted.
This container allows this setup to work flawlessly!
Also it is super small since Zigbee2Mqtt is build as a single binary and put into a FROM scratch container.
The container run as user 1000 with primary group 1000 and dailout(20) as secondary group for tty access.

## Test container with docker-compose

Expand All @@ -18,18 +20,21 @@ docker-compose up

### Building the container locally

You could build the container locally to add plugins. It works like this:
You could build the container locally like this:

```bash
docker build . \
--build-arg VERSION=1.4.0 \
--tag lansible/zigbee2mqtt:1.4.0
--build-arg ARCHITECTURE=amd64 \
--tag lansible/zigbee2mqtt:dev-amd64
```
The arguments are:

| Build argument | Description | Example |
|----------------|------------------------------------------------|-------------------------|
| `VERSION` | Version of Zigbee2MQTT | `1.4.0` |
| `ARCHITECTURE` | For what architecture to build the container | `arm64` |

Available architectures are what `lansible/nexe` supports:
https://hub.docker.com/r/lansible/nexe/tags

## Credits

Expand Down
29 changes: 0 additions & 29 deletions entrypoint.sh

This file was deleted.

File renamed without changes.

0 comments on commit 40bf71a

Please sign in to comment.