mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-01-19 17:34:43 +00:00
Setup the parser container to stay alive and run on a cron
This commit is contained in:
parent
c6b68029bf
commit
9ced864a48
9
app/t2-stat-parser/parser-daemon.sh
Executable file
9
app/t2-stat-parser/parser-daemon.sh
Executable file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "T2 Stat Parser Running...";
|
||||||
|
|
||||||
|
# Run this initially, then we'll execute this on a schedule
|
||||||
|
./start.sh
|
||||||
|
|
||||||
|
# Keep container running
|
||||||
|
tail -f /dev/null
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "starting..";
|
|
||||||
|
|
||||||
echo "Checking if build exists.."
|
echo "Checking if build exists.."
|
||||||
if [ -f /app/main ]
|
if [ -f /app/main ]
|
||||||
then
|
then
|
||||||
|
|
@ -11,5 +9,3 @@ else
|
||||||
echo "No build found, running from source"
|
echo "No build found, running from source"
|
||||||
go run *.go
|
go run *.go
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,31 +13,29 @@ COPY ./app/t2-stat-parser /app
|
||||||
|
|
||||||
# Copy and download dependency using go mod
|
# Copy and download dependency using go mod
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
|
|
||||||
# # Go Packages
|
|
||||||
# RUN go get -u -v \
|
|
||||||
# # GUID Generator
|
|
||||||
# github.com/rs/xid \
|
|
||||||
# # PostgreSQL Driver
|
|
||||||
# github.com/jackc/pgx \
|
|
||||||
# github.com/jmoiron/sqlx \
|
|
||||||
# # Better Error Handling
|
|
||||||
# github.com/pkg/errors
|
|
||||||
|
|
||||||
RUN go build -o main .
|
RUN go build -o main .
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------
|
||||||
|
# ------------------------------------------
|
||||||
|
|
||||||
# [ Stage 2]
|
# [ Stage 2]
|
||||||
|
|
||||||
FROM golang:1.14-alpine
|
FROM golang:1.14-alpine
|
||||||
RUN apk update && apk add --no-cache wget
|
|
||||||
|
|
||||||
LABEL maintainer="Anthony Mineo <anthonymineo@gmail.com>"
|
LABEL maintainer="Anthony Mineo <anthonymineo@gmail.com>"
|
||||||
|
|
||||||
|
RUN apk update && apk add --no-cache wget tzdata
|
||||||
|
|
||||||
|
#Set TimeZone
|
||||||
|
ENV TZ=America/New_York
|
||||||
|
|
||||||
|
#Set cron schedule (every day at 8am est)
|
||||||
|
RUN crontab -l -u root | echo "0 8 * * * sh -c \"/app/start.sh\"" | crontab -u root -
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /app/main /app/main
|
COPY --from=builder /app/main /app/main
|
||||||
COPY ./app/t2-stat-parser/start.sh /app/start.sh
|
COPY ./app/t2-stat-parser/start.sh /app/start.sh
|
||||||
|
COPY ./app/t2-stat-parser/parser-daemon.sh /app/parser-daemon.sh
|
||||||
|
|
||||||
ENTRYPOINT ./start.sh
|
ENTRYPOINT ./parser-daemon.sh
|
||||||
Loading…
Reference in a new issue