-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
61 lines (48 loc) · 2.37 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
FROM curlimages/curl:8.7.1 AS builder
# see https://github.com/openbikesensor/OpenBikeSensorFirmware/releases
ARG FIRMWARE_VERSION=0.19.877
RUN mkdir /tmp/obs
WORKDIR /tmp/obs
RUN curl --remote-name --location https://github.com/openbikesensor/OpenBikeSensorFirmware/releases/download/v${FIRMWARE_VERSION}/obs-v${FIRMWARE_VERSION}-initial-flash.zip && \
curl --remote-name --location https://github.com/openbikesensor/OpenBikeSensorFlash/releases/latest/download/flash.bin && \
unzip obs-v${FIRMWARE_VERSION}-initial-flash.zip && \
rm obs-v${FIRMWARE_VERSION}-initial-flash.zip
COPY --chown=100 ./public-html/ ./
RUN sed -i "s/FIRMWARE_VERSION/${FIRMWARE_VERSION}/g" /tmp/obs/index.html && \
sed -i "s/FIRMWARE_VERSION/${FIRMWARE_VERSION}/g" /tmp/obs/manifest.json && \
mv /tmp/obs/manifest.json /tmp/obs/manifest-${FIRMWARE_VERSION}.json
RUN for file in *.bin; \
do \
if [ -f "${file}" ]; \
then \
sha256=`sha256sum -b ${file} | cut -c1-32`; \
mv ${file} ${sha256}-${file}; \
sed -i "s/${file}/${sha256}-${file}/g" manifest-*.json; \
fi \
done
RUN chmod -R a=rX .
# based on infos here https://github.com/espressif/esptool-js/blob/main/.github/workflows/ci.yml#L16
FROM node:20-bullseye AS nodebuilder
# see at https://github.com/esphome/esp-web-tools/releases
ARG ESP_WEB_TOOLS_VERSION=10.0.1
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update -qq && \
apt-get install -y -qq jq && \
npm install -g [email protected]
WORKDIR /tmp/esp-web-tool
RUN curl --remote-name --location https://github.com/esphome/esp-web-tools/archive/refs/tags/${ESP_WEB_TOOLS_VERSION}.zip && \
unzip *.zip && \
rm *.zip && \
mv */* . && \
# make unsupported browser hint more visible
sed -i "/'unsupported'/ s|\(<slot.*unsupported.*slot>\)|<div style='font-size:xx-large;color:red;font-weight:bold;'>\1</div>|" src/install-button.ts && \
npm ci && \
script/build && \
npm exec -- prettier --check src && \
chmod -R a=rX /tmp/esp-web-tool/dist
FROM httpd:2.4-alpine
LABEL version="${FIRMWARE_VERSION}" \
description="OpenBikeSensor Firmware with ESP Web Tools" \
maintainer="[email protected]"
COPY --chown=nobody:nogroup --from=builder /tmp/obs/ /usr/local/apache2/htdocs/
COPY --chown=nobody:nogroup --from=nodebuilder /tmp/esp-web-tool/dist/web/ /usr/local/apache2/htdocs/esp-web-tools