Skip to content

Commit 26f678a

Browse files
authored
New Docker workflow (#13)
1 parent dbe24a8 commit 26f678a

File tree

4 files changed

+46
-24
lines changed

4 files changed

+46
-24
lines changed

.dockerignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/node_modules
2+
/doc
3+
/testscripts*
4+
/.nyc_output
5+
/test.js
6+
/Gulpfile.js
7+
/coverage
8+
/mockdate.js
9+
/.npmignore
10+
11+
12+
## Git
13+
/.git
14+
/.gitignore
15+
16+
## Docker
17+
Dockerfile
18+
/.dockerignore
19+
20+
## macOS
21+
.DS_Store
22+
.AppleDouble
23+
.LSOverride
24+
._*

Dockerfile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
FROM node as jsbuilder
2+
3+
COPY . /app
4+
WORKDIR /app
5+
6+
RUN npm install
7+
8+
# ---------------------------------------------------------
9+
110
FROM node:slim
211

3-
COPY . /node
12+
COPY --from=jsbuilder /app /app
413

5-
RUN cd /node && \
6-
npm install
14+
WORKDIR /app
715

8-
ENTRYPOINT [ "node", "/node/index.js" ]
16+
EXPOSE 3000
17+
ENTRYPOINT [ "node", "index.js" ]

Dockerfile.armhf

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ To run with Docker, use either a [pre-build image](https://hub.docker.com/r/ders
5454

5555
becomes
5656

57-
```docker run dersimn/mqtt-scripts --help```
57+
```docker run dersimn/mqtt-scripts:1 --help```
5858

5959
An example for a productive configuration would be:
6060

6161
```
6262
docker run -d --restart=always --name=logic \
6363
-e "TZ=Europe/Berlin" \
6464
-v /opt/hma/etc/scripts:/scripts:ro \
65-
dersimn/mqtt-scripts \
65+
dersimn/mqtt-scripts:1 \
6666
--url mqtt://10.1.1.50 \
6767
--dir /scripts
6868
```
@@ -72,19 +72,16 @@ Configure via `MQTTSCRIPTS_` env variables when using Docker Compose.
7272

7373
#### Build
7474

75-
To build a Docker image yourself use the following workflow:
75+
Docker development build:
7676

77-
```
78-
git clone https://github.com/hobbyquaker/mqtt-scripts.git
79-
cd mqtt-scripts
80-
docker build -t mqtt-scripts .
81-
```
77+
docker build -t mqtt-scripts .
78+
docker run --rm mqtt-scripts --help
8279

83-
To build for the Raspberry Pi, run:
80+
Docker Hub deploy:
8481

85-
```
86-
docker build -t mqtt-scripts:armhf -f Dockerfile.armhf .
87-
```
82+
docker buildx create --name mybuilder
83+
docker buildx use mybuilder
84+
docker buildx build --platform linux/amd64,linux/arm/v7 -t dersimn/mqtt-scripts:1 -t dersimn/mqtt-scripts:1.x.x --push .
8885

8986

9087
# Command Line Options

0 commit comments

Comments
 (0)