Skip to content

Commit

Permalink
feat(docker): add docker files and setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Dec 6, 2023
1 parent 1ccd8af commit 751ca17
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

docker build --no-cache --progress plain --tag tieske/homie-zipato:dev .
# docker image push tieske/homie-zipato:dev
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM akorn/luarocks:lua5.1-alpine as build

RUN apk add \
gcc \
git \
libc-dev \
make

# install dependencies separately to not have --dev versions for them as well
# RUN luarocks install copas \
# && luarocks install luasec \
# && luarocks install penlight \
# && luarocks install Tieske/luamqtt --dev \
# && luarocks install homie --dev \
# && luarocks install luabitop

# copy the local repo contents and build it
COPY ./ /tmp/homie-millheat
WORKDIR /tmp/homie-millheat
RUN luarocks make

# collect cli scripts; the ones that contain "LUAROCKS_SYSCONFDIR" are Lua ones
RUN mkdir /luarocksbin \
&& grep -rl LUAROCKS_SYSCONFDIR /usr/local/bin | \
while IFS= read -r filename; do \
cp "$filename" /luarocksbin/; \
done



FROM akorn/lua:5.1-alpine

ENV HOMIE_LOG_LOGLEVEL "debug"

# copy luarocks tree and data over
COPY --from=build /luarocksbin/* /usr/local/bin/
COPY --from=build /usr/local/lib/lua /usr/local/lib/lua
COPY --from=build /usr/local/share/lua /usr/local/share/lua
COPY --from=build /usr/local/lib/luarocks /usr/local/lib/luarocks

CMD ["homie-zipato"]
27 changes: 27 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

# export HOMIE_LOG_LOGGER="rsyslog"
export HOMIE_LOG_LOGLEVEL="debug"
# export HOMIE_LOG_LOGPATTERN="%message (%source)"
# export HOMIE_LOG_RFC="rfc5424"
# export HOMIE_LOG_MAXSIZE="8000"
# export HOMIE_LOG_HOSTNAME="synology.local"
# export HOMIE_LOG_PORT="8514"
# export HOMIE_LOG_PROTOCOL="tcp"
# export HOMIE_LOG_IDENT="homiemillheat"


# LUA_PATH="./src/?/init.lua;./src/?.lua;$LUA_PATH"
# lua bin/homie-zipato.lua

docker run -it --rm \
-e HOMIE_LOG_LOGGER \
-e HOMIE_LOG_LOGLEVEL \
-e HOMIE_LOG_LOGPATTERN \
-e HOMIE_LOG_RFC \
-e HOMIE_LOG_MAXSIZE \
-e HOMIE_LOG_HOSTNAME \
-e HOMIE_LOG_PORT \
-e HOMIE_LOG_PROTOCOL \
-e HOMIE_LOG_IDENT \
tieske/homie-zipato:dev

0 comments on commit 751ca17

Please sign in to comment.