Skip to content

Commit

Permalink
Ritorno a python:3-alpine con builder per minor dimensione immagine.
Browse files Browse the repository at this point in the history
versione 1.2.3. Closes #5.
  • Loading branch information
criluc committed Mar 8, 2021
1 parent 8297257 commit 1402fcb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unrelesead] - 2021-01-29
## [1.2.3] - 2021-03-08
### Changed
- Ritorno alla python:3-alpine con builder separato per diminuire dimensioni immagine,
grazie a @callido-serpe e @GothoRemotho per la modifica.
- Fix __str__ di Stamping per i casi in cui alcuni attributi non sono presenti

## [1.2.2] - 2021-01-15
Expand Down
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
FROM python:3-slim

FROM python:3-alpine as builder
LABEL maintainer="Cristian Lucchesi <[email protected]>"

RUN apt-get update && apt-get -y install cron && apt-get clean
WORKDIR /client
RUN apk --update add make build-base gcc musl-dev python3-dev libffi-dev openssl-dev cargo
WORKDIR /
COPY requirements.txt .
RUN pip install wheel && mkdir /wheels && pip wheel --wheel-dir=/wheels -r requirements.txt

FROM python:3-alpine
WORKDIR /client
ADD / .

RUN pip install -r requirements.txt && mkdir data
COPY --from=builder /wheels /wheels
RUN pip install --no-index --find-links=/wheels -r requirements.txt
RUN apk --update add bash && rm -rf /wheels && mkdir /data

CMD ["bash","/client/docker_conf/init"]
6 changes: 3 additions & 3 deletions docker_conf/cron
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{CRON}} /usr/local/bin/python -c "import random; import time; time.sleep(random.randint(0,{{CRON_RANDOM_SLEEP}}))" && /client/executeClient.sh >/dev/null 2>&1
{{PROBLEMS_CRON}} /usr/local/bin/python -c "import random; import time; time.sleep(random.randint(0,{{CRON_RANDOM_SLEEP}}))" && /client/badStampings.sh >/dev/null 2>&1
0 0 * * * /client/cleanLogs.sh >/dev/null 2>&1
{{CRON}} python -c "import random; import time; time.sleep(random.randint(0,{{CRON_RANDOM_SLEEP}}))" && /client/executeClient.sh >/dev/null 2>&1
{{PROBLEMS_CRON}} python -c "import random; import time; time.sleep(random.randint(0,{{CRON_RANDOM_SLEEP}}))" && /client/badStampings.sh >/dev/null 2>&1
0 0 * * * /client/cleanLogs.sh >/dev/null 2>&1
2 changes: 0 additions & 2 deletions docker_conf/executeClient.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
echo "=== " `date +'%Y/%m/%d %H:%M:%S'` "==="
# Posiziona sulla directory dove si trova questa procedura
cd `dirname $0`
# nell'immagine python:3-slim il python e' in /usr/local/bin
PATH=$PATH:/usr/local/bin

echo "===" Esecuzione del client python per l''invio delle timbrature a epas
# Avvia il client python scaricare le timbrature da file locali/ftp/sftp,
Expand Down
2 changes: 1 addition & 1 deletion docker_conf/init
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@ sed -i 's#{{PROBLEMS_CRON}}#'"${PROBLEMS_CRON}"'#' /tmp/cron
sed -i 's#{{CRON_RANDOM_SLEEP}}#'"${CRON_RANDOM_SLEEP}"'#' /tmp/cron

crontab /tmp/cron
cron -f
crond -f

exit 0

0 comments on commit 1402fcb

Please sign in to comment.