Skip to content

Commit 26fc09f

Browse files
committed
Install dependencies of compile-examples action in Dockerfile
- Move the dependencies installations out of entrypoint.sh - Pin Python version to 3.8.2
1 parent fc62f67 commit 26fc09f

File tree

2 files changed

+6
-41
lines changed

2 files changed

+6
-41
lines changed

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
# Container image that runs your code
2-
FROM ubuntu:latest
1+
FROM python:3.8.2
32

43
# Install prerequisites
5-
RUN apt-get update --quiet=2 && apt-get install --quiet=2 --assume-yes wget
6-
CMD /bin/bash
4+
RUN apt-get update && apt-get install -y git wget jq curl \
5+
&& rm -rf /var/lib/apt/lists/*
76

87
# Copies your code file from your action repository to the filesystem path `/` of the container
98
COPY entrypoint.sh /entrypoint.sh
109
COPY reportsizetrends /reportsizetrends
1110

11+
# Install python dependencies
12+
RUN pip install -r /reportsizetrends/requirements.txt
13+
1214
# Code file to execute when the docker container starts up (`entrypoint.sh`)
1315
ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,6 @@ if [[ "$ENABLE_SIZE_TRENDS_REPORT" == "true" && "$SIZE_TRENDS_REPORT_SPREADSHEET
115115
exit 1
116116
fi
117117

118-
if [[ "$ENABLE_SIZE_DELTAS_REPORT" == "true" || "$ENABLE_SIZE_TRENDS_REPORT" == "true" ]]; then
119-
apt-get install --quiet=2 --assume-yes curl >/dev/null || {
120-
echo "::error::Failed to install curl"
121-
exit 1
122-
}
123-
124-
# https://stedolan.github.io/jq/
125-
apt-get install --quiet=2 --assume-yes jq >/dev/null || {
126-
echo "::error::Failed to install jq"
127-
exit 1
128-
}
129-
fi
130-
131118
# Only publish size trends report on push to the default branch
132119
if [[ "$ENABLE_SIZE_TRENDS_REPORT" == "true" ]]; then
133120
# Determine the current branch
@@ -192,22 +179,6 @@ fi
192179
mkdir --parents "$HOME/Arduino/libraries"
193180
ln --symbolic "$PWD" "$HOME/Arduino/libraries/."
194181

195-
if [[ "$ENABLE_SIZE_TRENDS_REPORT" == "true" ]]; then
196-
apt-get install --quiet=2 --assume-yes python3 >/dev/null || {
197-
echo "::error::Failed to install Python"
198-
exit 1
199-
}
200-
apt-get install --quiet=2 --assume-yes python3-pip >/dev/null || {
201-
echo "::error::Failed to install pip"
202-
exit 1
203-
}
204-
# Install dependencies of reportsizetrends.py
205-
pip3 install --quiet --requirement /reportsizetrends/requirements.txt || {
206-
echo "::error::Failed to install Python modules"
207-
exit 1
208-
}
209-
fi
210-
211182
# Find all the examples and loop build each
212183
readonly EXAMPLES="$(find "examples/" -name '*.ino' -print0 | xargs --null dirname | uniq)"
213184
if [[ "$EXAMPLES" == "" ]]; then
@@ -234,14 +205,6 @@ for EXAMPLE in $EXAMPLES; do
234205
}
235206
check_sizes
236207

237-
# Install Git
238-
if [[ "$ENABLE_SIZE_DELTAS_REPORT" == "true" || "$ENABLE_SIZE_TRENDS_REPORT" == "true" ]]; then
239-
apt-get install --quiet=2 --assume-yes git >/dev/null || {
240-
echo "::error::Failed to install git"
241-
exit 1
242-
}
243-
fi
244-
245208
readonly CURRENT_FLASH_SIZE="$FLASH_SIZE"
246209
readonly CURRENT_RAM_SIZE="$RAM_SIZE"
247210

0 commit comments

Comments
 (0)