feat(devops): tried to fix ci

This commit is contained in:
Maieul BOYER 2026-01-14 14:10:39 +01:00 committed by Maix0
parent d0e787e2c7
commit ac2e3669ca
4 changed files with 48 additions and 15 deletions

View file

@ -14,5 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Generate valid .enva
run: make generateEnv
- name: Build the Docker image
run: make all
run: make all CI=y

View file

@ -1,16 +1,46 @@
.PHONY: logs
# Set DEV only if it is not already set and .dev file exists
IS_CI=n
IS_DEV=n
REDUCED_SET=n
DOCKER_SERVICE=
ifndef DEV
ifeq "$(wildcard .dev)" ".dev"
IS_DEV := y
REDUCED_SET := y
endif
endif
ifeq "$(DEV)" "y"
IS_DEV := y
REDUCED_SET := y
endif
ifeq "$(CI)" "y"
IS_CI := y
REDUCED_SET := y
endif
# TODO: REMOVE THIS BEFORE LAUNCH
# this allows the us to only start the non-monitoring sercices
#DOCKER_SERVICE= \
# auth \
# chat \
# tic-tac-toe \
# nginx \
# user \
# pong \
ifeq "$(REDUCED_SET)" "y"
DOCKER_SERVICE := \
auth \
chat \
tic-tac-toe \
nginx \
user \
pong
endif
all: build
@[ $(REDUCED_SET) = y ] && echo -e "\x1b[31mUSING REDUCED SET OF DOCKER CONTAINER\x1b[0m" || true
@[ $(IS_DEV) = y ] && echo -e "\x1b[31mUsing dev mode => remove .dev if needed\x1b[0m" || true
@[ $(IS_CI) = y ] && echo -e "\x1b[31mUsing CI mode => Check env if needed\x1b[0m" || true
docker compose up -d $(DOCKER_SERVICE)
logs:
@ -20,6 +50,9 @@ down:
docker compose down
build: .env
@[ $(REDUCED_SET) = y ] && echo -e "\x1b[31mUSING REDUCED SET OF DOCKER CONTAINER\x1b[0m" || true
@[ $(IS_DEV) = y ] && echo -e "\x1b[31mUsing dev mode => remove .dev if needed\x1b[0m" || true
@[ $(IS_CI) = y ] && echo -e "\x1b[31mUsing CI mode => Check env if needed\x1b[0m" || true
docker compose build $(DOCKER_SERVICE)
re:

View file

@ -151,5 +151,10 @@ fnginx: nginx-dev/nginx nginx-dev/nginx-selfsigned.crt nginx-dev/nginx-selfsigne
jwt_secret:
sh -c "dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64 | tr -d -- '\n' | tr -- '+/' '-_'; echo"
generateEnv:
cp env.example .env
sed -i 's/^JWT_SECRET=.*/JWT_SECRET=$(shell sh -c "dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64 | tr -d -- '\n' | tr -- '+/' '-_'; echo")/' .env
# phony
.PHONY: all clean fclean re header footer npm@install npm@clean npm@fclean npm@build sql tmux logs jwt_secret

View file

@ -4,17 +4,12 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
dbmlSQLite = {
url = "github:maix0/DBML_SQLite";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
dbmlSQLite,
}:
flake-utils.lib.eachDefaultSystem (
system: let
@ -44,7 +39,6 @@
packages = with pkgs; [
act
clang
dbmlSQLite.packages.${system}.default
gnumake
lazydocker
nodejs_22
@ -64,7 +58,6 @@
export PODMAN_COMPOSE_WARNING_LOGS="false";
export DATABASE_DIR="$(realpath .)/db"
mkdir -p $DATABASE_DIR
export JWT_SECRET="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
'';
};
}