fixed some minor bugs, added docker files

This commit is contained in:
Daniel Sommer 2023-01-31 16:46:28 +01:00
parent 2437680c29
commit 40941e6bf4
5 changed files with 63 additions and 5 deletions

View file

@ -15,7 +15,7 @@ report:
- "Pause-Dauer"
users:
dsommer:
password: "$Velvet90"
user:
password: "myS00perS3cr3tPa$$word"
debug: true

21
config/config.yml Normal file
View file

@ -0,0 +1,21 @@
database: /home/velvettear/worklog/worklog.sqlite
server:
listen: "0.0.0.0"
port: 5000
report:
headers:
- "Datum"
- "Arbeitstag-Beginn"
- "Arbeitstag-Ende"
- "Arbeitstag-Dauer"
- "Pause-Beginn"
- "Pause-Ende"
- "Pause-Dauer"
users:
dsommer:
password: "myS00perS3cr3tPa$$word"
debug: true

11
docker-compose.yml Normal file
View file

@ -0,0 +1,11 @@
version: "3"
services:
worklog:
build: ./docker
container_name: worklog
restart: unless-stopped
volumes:
- ./config:/root/.config/worklog
ports:
- 5000:5000

29
docker/Dockerfile Normal file
View file

@ -0,0 +1,29 @@
FROM alpine:3.17
LABEL version="1.0.0" \
author="Daniel Sommer <daniel.sommer@nux.de>" \
license="MIT"
MAINTAINER Daniel Sommer <daniel.sommer@nux.de>
ENV LANG=C.UTF-8
RUN apk upgrade --no-cache --progress \
&& apk add --no-cache --progress \
tzdata \
git \
go \
&& ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime \
&& echo "Europe/Berlin" > /etc/timezone \
&& git clone https://git.velvettear.de/velvettear/worklog.git /tmp/worklog \
&& cd /tmp/worklog \
&& go build \
&& mv /tmp/worklog/worklog /usr/bin/worklog \
&& rm -rf /tmp/worklog \
&& apk del --no-cache --progress \
git \
go
EXPOSE 5000
ENTRYPOINT ["worklog"]

View file

@ -87,9 +87,6 @@ func GetToday(user string) (Workday, error) {
workday.Start = firstTimestamp.Start
workday.Stop = firstTimestamp.End
workday.Duration = workday.Stop.Sub(workday.Start)
if workday.isOpen() {
return workday, nil
}
currentTimestamp := database.GetLastTimestamp(user, time.Now())
workday.Stop = currentTimestamp.End
if workday.Stop == tools.ZeroDate {