Skip to content

Commit bb51bb9

Browse files
committed
smaller image size, verbose flag, and lib search
1 parent 7646730 commit bb51bb9

File tree

15 files changed

+106
-49
lines changed

15 files changed

+106
-49
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
base-all
1+
base-all/data/arduino
2+
base-all/data/arduino-downloads
23
Arduino
34
node_modules
45
.env

Dockerfile

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,52 @@
1-
FROM duinoapp/arduino-cli-base:latest
1+
FROM node:10-buster
2+
3+
USER root
4+
RUN useradd duino
5+
6+
COPY setup/index.js /home/duino/setup/index.js
7+
COPY setup/arduino-cli.yml /home/duino/data/arduino-cli.yml
8+
# COPY Arduino /home/duino/Arduino
9+
10+
# RUN mkdir /home/duino
11+
RUN chown duino:duino /home/duino -R
12+
RUN apt-get update && apt-get install build-essential -y
13+
14+
WORKDIR /home/duino
15+
USER duino
16+
17+
RUN wget https://github.com/arduino/arduino-cli/releases/download/0.13.0/arduino-cli_0.13.0_Linux_64bit.tar.gz -O - | tar -xz
18+
19+
RUN ls
20+
21+
22+
ENV CLI_ARGS="--config-file /home/duino/data/arduino-cli.yml --format json"
23+
RUN ./arduino-cli core update-index ${CLI_ARGS}
24+
RUN ./arduino-cli core search "" ${CLI_ARGS} > /home/duino/data/cores.json
25+
26+
RUN ./arduino-cli lib update-index ${CLI_ARGS}
27+
RUN ./arduino-cli lib search "" ${CLI_ARGS} > /home/duino/data/libs.json
28+
29+
RUN node setup/ cores
30+
RUN node setup/ boards
231

332
USER root
433
COPY package*.json /home/duino/
534
RUN chown duino:duino /home/duino/package*.json
35+
RUN apt-get install nano
636
USER duino
737

838
RUN npm ci
939

1040
USER root
1141
COPY src /home/duino/src
1242
RUN chown duino:duino /home/duino/src -R
43+
RUN mkdir /data
44+
RUN chmod 0777 /data
45+
COPY entrypoint.sh /home/duino/
46+
COPY load-libs.sh /home/duino/
47+
RUN chmod +x ./*.sh
48+
RUN chown duino:duino ./*.sh
1349
USER duino
1450

1551
EXPOSE 3030
16-
CMD [ "node", "src/index.js" ]
52+
CMD [ "./entrypoint.sh" ]

base-all/data/.dockerignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

base-all/data/Dockerfile

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

base-all/data/arduino-downloads/.gitkeep

Whitespace-only changes.

base-all/data/arduino/.gitkeep

Whitespace-only changes.

deployment/docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ services:
2525
image: duinoapp/duinoapp-server:latest
2626
container_name: duinoapp
2727
restart: unless-stopped
28+
volumes:
29+
- duinoapp-lib-downloads:/data
2830
environment: # update these, server info displayed to users
2931
- SERVER_INFO_NAME=Example Server
3032
- SERVER_INFO_LOCATION=Australia/Sydney
3133
# must be a two letter country code
3234
- SERVER_INFO_COUNTRY=AU
3335
- SERVER_INFO_OWNER=Jane Smith
3436
- SERVER_INFO_WEBSITE=site.example.com
35-
- SERVER_INFO_DESCRIPTION=Just Another Example Server
37+
- SERVER_INFO_DESCRIPTION=Just Another Example Server
38+
volumes:
39+
duinoapp-lib-downloads:

entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
./load-libs.sh
3+
4+
node src/index.js

load-libs.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
file="/data/arduino.tar.gz"
2+
uri="http://duino-dump.s3-website.us-east-2.amazonaws.com/arduino.tar.gz"
3+
4+
curl -o "$file" -z "$file" "$uri"
5+
rm -rf /home/duino/Arduino
6+
tar -xzf $file
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
board_manager:
22
additional_urls:
33
- http://arduino.esp8266.com/stable/package_esp8266com_index.json
4+
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
45
arduino_data: '/home/duino/data/arduino/'
56
downloads_dir: '/home/duino/data/arduino-downloads/'

0 commit comments

Comments
 (0)