-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerfile: * Updating base image Signed-off-by: Tuan T. Pham <[email protected]>
- Loading branch information
Showing
6 changed files
with
26 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
FROM python:alpine3.18 as builder | ||
FROM python:3.9.18-alpine3.18 as builder | ||
LABEL maintainer "tuan t. pham" <[email protected]> | ||
|
||
ENV PKGS="py3-virtualenv" | ||
|
||
RUN apk update && apk add ${PKGS} \ | ||
&& mkdir -p /opt/pp-code-metrics | ||
|
||
COPY ./requirements.txt /opt/pp-code-metrics | ||
|
||
RUN cd /opt/pp-code-metrics \ | ||
&& virtualenv metrics \ | ||
&& source /opt/pp-code-metrics/metrics/bin/activate \ | ||
|
@@ -17,9 +15,10 @@ RUN cd /opt/pp-code-metrics \ | |
|
||
FROM mikefarah/yq:latest as yq_base | ||
|
||
FROM python:alpine3.18 as deploy | ||
FROM python:3.9.18-alpine3.18 as deploy | ||
|
||
ENV PKGS="py3-virtualenv" | ||
ENV DOCKERIZE_URL="https://github.com/jwilder/dockerize/releases/download/v0.7.0/dockerize-alpine-linux-amd64-v0.7.0.tar.gz" | ||
|
||
RUN apk update && apk add ${PKGS} \ | ||
&& mkdir -p /opt/pp-code-metrics | ||
|
@@ -34,4 +33,11 @@ COPY --from=yq_base /usr/bin/yq /usr/bin/yq | |
WORKDIR /opt/pp-code-metrics | ||
ENV VIRT_PYTHON=/opt/pp-code-metrics/metrics/bin/python3 | ||
|
||
CMD ["/opt/pp-code-metrics/run_get_metrics.sh", "my_settings.yml"] | ||
RUN wget -O - ${DOCKERIZE_URL} | tar xzf - -C /usr/local/bin | ||
|
||
RUN mkdir -p /etc/cron.d | ||
COPY crontab/pp-code-metrics.tmpl /etc/cron.d/ | ||
ENTRYPOINT dockerize --template /etc/cron.d/pp-code-metrics.tmpl:/etc/cron.d/pp-code-metrics crontab /etc/cron.d/pp-code-metrics && \ | ||
/usr/sbin/crond -f -d 0 | ||
|
||
#CMD ["/opt/pp-code-metrics/run_get_metrics.sh", "my_settings.yml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Run get_metrics.py every 10 minutes | ||
|
||
# | ||
|
||
*/{{ .Env.INTERVAL }} * * * * /opt/pp-code-metrics/run_get_metrics.sh my_settings.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
#!/usr/bin/env sh | ||
set -o nounset # Treat unset variables as an error | ||
|
||
INTERVAL=$(cat $1 | yq '.General.interval') | ||
echo "INTERVAL=$INTERVAL" | ||
#INTERVAL=$(cat $1 | yq '.General.interval') | ||
#echo "INTERVAL=$INTERVAL" | ||
#INTERVAL=${INTERVAL:=600} | ||
|
||
VIRT_PYTHON=${VIRT_PYTHON:=/home/vagrant/.virtualenvs/metrics/bin/python3} | ||
|
||
while true; do | ||
${VIRT_PYTHON} ./get_metrics.py --config $1 | ||
sleep ${INTERVAL}s | ||
done | ||
cd /opt/pp-code-metrics | ||
${VIRT_PYTHON} ./get_metrics.py --config $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters