Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ ADD . /src
RUN make

FROM docker.io/alpine:3.15
RUN apk add -U ncurses-libs
ARG TIMEZONE=UTC
COPY --from=0 /src/tty-clock /usr/bin/tty-clock
CMD ['/usr/bin/tty-clock']
RUN apk add -U ncurses-libs tzdata && \
cp -rf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why isn't this just a TZ environment that can be passed by the docker run caller?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, that works too, you can set the default for the container with the build argument, as well as override it at runtime with the environment TZ. I could remove the default, but I think its nice to be able to set it and not have to specify it again.


3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ INSTALLPATH ?= ${DESTDIR}${PREFIX}/bin
MANPATH ?= ${DESTDIR}${PREFIX}/share/man/man1
DOCKER ?= docker
DOCKER_IMAGE ?= localhost/tty-clock
DOCKER_TIMEZONE ?= UTC

ifeq ($(shell sh -c 'which ncurses6-config>/dev/null 2>/dev/null && echo y'), y)
CFLAGS += -Wall -g $$(ncurses6-config --cflags)
Expand Down Expand Up @@ -61,5 +62,5 @@ clean :

docker :

${DOCKER} build -t ${DOCKER_IMAGE} .
${DOCKER} build --build-arg=TIMEZONE=${DOCKER_TIMEZONE} -t ${DOCKER_IMAGE} .
@echo "Run the container: ${DOCKER} run --rm -it ${DOCKER_IMAGE} tty-clock --help"