Skip to content

Commit

Permalink
Bump version 0.7.00
Browse files Browse the repository at this point in the history
Fix dockerFile access logs

fix docker

fix docker file bump 0.00.7
  • Loading branch information
syji35 committed Jun 12, 2024
1 parent 7a4b231 commit 58189ee
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 1,019 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ name: Build Docker

on:
push:
branches: ["main","develop"]
branches: ["main"]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
tags: [ '*.*.*' ]


env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.deploy/**
39 changes: 25 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM debian:12-slim

ARG LUFI_VERSION=0.05.21
ARG LUFI_VERSION=0.07.0
ARG GID=1000
ARG UID=1000


USER root

Expand All @@ -9,6 +12,7 @@ RUN apt update \
wget \
unzip \
cron \
sudo \
build-essential \
libssl-dev \
zlib1g-dev \
Expand All @@ -18,30 +22,37 @@ RUN apt update \
&& apt-get clean -y \
&& rm -rf /var/lib/{apt,dpkg,cache,log,tmp}/*

RUN addgroup --gid "$GID" nonroot
RUN adduser --uid "$UID" --gid "$GID" --disabled-password --gecos "" nonroot
RUN echo 'nonroot ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

# copie des cron
COPY lufi-cron /etc/cron.d/lufi-cron
RUN chmod 0644 /etc/cron.d/lufi-cron
COPY --chmod=644 lufi-cron /etc/cron.d/lufi-cron

RUN cpan Carton
WORKDIR /lufi

WORKDIR /home/nonroot/lufi


RUN wget https://framagit.org/fiat-tux/hat-softwares/lufi/-/archive/${LUFI_VERSION}/lufi-${LUFI_VERSION}.zip \
&& unzip lufi-${LUFI_VERSION}.zip -d /tmp \
&& mv /tmp/lufi-${LUFI_VERSION}/* /lufi \
&& rm -rf /tmp/* lufi-${LUFI_VERSION}.zip

&& mv /tmp/lufi-${LUFI_VERSION}/* /home/nonroot/lufi \
&& rm -rf /tmp/* \
&& rm -rf /home/nonroot/lufi/lufi-${LUFI_VERSION}.zip

COPY lufi.conf /lufi/lufi.conf
RUN mkdir -p themes/megalis
COPY themes/megalis /lufi/themes/megalis
COPY docker-entrypoint.sh /lufi/docker-entrypoint.sh
RUN chmod a+x /lufi/docker-entrypoint.sh

COPY --chown=nonroot:nonroot lufi.conf /
RUN mkdir -p themes/megalis/
COPY themes/megalis themes/megalis/
COPY --chmod=760 --chown=nonroot:nonroot docker-entrypoint.sh /home/nonroot/lufi/docker-entrypoint.sh

RUN carton install --deployment --without=test --without=mysql \
&& rm -rf local/cache/* local/man/*

RUN chown -R nonroot:nonroot .

EXPOSE 8081
ENTRYPOINT ["/lufi/docker-entrypoint.sh"]
USER nonroot

RUN mkdir /home/nonroot/lufi/files

ENTRYPOINT ["/home/nonroot/lufi/docker-entrypoint.sh"]
14 changes: 0 additions & 14 deletions docker-compose.yml

This file was deleted.

35 changes: 35 additions & 0 deletions docker-compose_sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.7"

volumes:
files:

configs:
lufi_config.v1:
file: config/opensignature/Config.php

services:
lufi:
build:
context: .
dockerfile: Dockerfile
container_name: lufi-app
ports:
- "8081:8081"
restart: unless-stopped
configs:
- source: lufi_config.v1
target: /home/nonroot/lufi/lufi.conf
volumes:
- files:/lufi/files


lufi-cron:
build:
context: .
dockerfile: Dockerfile
command: cron
configs:
- source: lufi_config.v1
target: /home/nonroot/lufi/lufi.conf
volumes:
- files:/lufi/files
7 changes: 4 additions & 3 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ else
fi

if [ "$command" = "start" ]; then
carton exec hypnotoad /lufi/script/lufi
echo "Starting Lufi ..." >> /home/nonroot/lufi/log/production.log
carton exec hypnotoad /home/nonroot/lufi/script/lufi
elif [ "$command" = "cron" ]; then
echo "Executing cron" >> /lufi/log/production.log
echo "Executing cron" >> /home/nonroot/lufi/log/production.log
crontab /etc/cron.d/lufi-cron
cron -f &
else
Expand All @@ -19,4 +20,4 @@ else
fi

# print logs
tail -f /lufi/log/production.log
tail -f /home/nonroot/lufi/log/production.log
8 changes: 4 additions & 4 deletions lufi-cron
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0 4 * * * echo "$(date) Launch cron cleanfiles" >> /lufi/log/production.log 2>&1
0 4 * * * cd /lufi && /usr/local/bin/carton exec /lufi/script/lufi cron cleanfiles >> /lufi/log/production.log 2>&1
0 2 * * * echo "$(date) Launch cron cleanbdd" >> /lufi/log/production.log 2>&1
0 2 * * * cd /lufi && /usr/local/bin/carton exec /lufi/script/lufi cron cleanbdd >> /lufi/log/production.log 2>&1
0 4 * * * echo "$(date) Launch cron cleanfiles" >> /home/nonroot/lufi/log/production.log 2>&1
0 4 * * * cd /home/nonroot/lufi && /usr/local/bin/carton exec /lufi/script/lufi cron cleanfiles >> /home/nonroot/log/production.log 2>&1
0 2 * * * echo "$(date) Launch cron cleanbdd" >> /home/nonroot/lufi/log/production.log 2>&1
0 2 * * * cd /home/nonroot/lufi && /usr/local/bin/carton exec /home/nonroot/lufi/script/lufi cron cleanbdd >> /home/nonroot/lufi/log/production.log 2>&1
Loading

0 comments on commit 58189ee

Please sign in to comment.