feat(devops): tried to fix ci
This commit is contained in:
parent
d0e787e2c7
commit
ac2e3669ca
4 changed files with 48 additions and 15 deletions
4
.github/workflows/docker-image.yml
vendored
4
.github/workflows/docker-image.yml
vendored
|
|
@ -14,5 +14,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- name: Generate valid .enva
|
||||||
|
run: make generateEnv
|
||||||
- name: Build the Docker image
|
- name: Build the Docker image
|
||||||
run: make all
|
run: make all CI=y
|
||||||
|
|
|
||||||
47
Docker.mk
47
Docker.mk
|
|
@ -1,16 +1,46 @@
|
||||||
.PHONY: logs
|
.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
|
# TODO: REMOVE THIS BEFORE LAUNCH
|
||||||
# this allows the us to only start the non-monitoring sercices
|
# this allows the us to only start the non-monitoring sercices
|
||||||
#DOCKER_SERVICE= \
|
ifeq "$(REDUCED_SET)" "y"
|
||||||
# auth \
|
DOCKER_SERVICE := \
|
||||||
# chat \
|
auth \
|
||||||
# tic-tac-toe \
|
chat \
|
||||||
# nginx \
|
tic-tac-toe \
|
||||||
# user \
|
nginx \
|
||||||
# pong \
|
user \
|
||||||
|
pong
|
||||||
|
endif
|
||||||
|
|
||||||
all: build
|
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)
|
docker compose up -d $(DOCKER_SERVICE)
|
||||||
|
|
||||||
logs:
|
logs:
|
||||||
|
|
@ -20,6 +50,9 @@ down:
|
||||||
docker compose down
|
docker compose down
|
||||||
|
|
||||||
build: .env
|
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)
|
docker compose build $(DOCKER_SERVICE)
|
||||||
|
|
||||||
re:
|
re:
|
||||||
|
|
|
||||||
5
Makefile
5
Makefile
|
|
@ -151,5 +151,10 @@ fnginx: nginx-dev/nginx nginx-dev/nginx-selfsigned.crt nginx-dev/nginx-selfsigne
|
||||||
jwt_secret:
|
jwt_secret:
|
||||||
sh -c "dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64 | tr -d -- '\n' | tr -- '+/' '-_'; echo"
|
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
|
||||||
.PHONY: all clean fclean re header footer npm@install npm@clean npm@fclean npm@build sql tmux logs jwt_secret
|
.PHONY: all clean fclean re header footer npm@install npm@clean npm@fclean npm@build sql tmux logs jwt_secret
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,12 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs";
|
nixpkgs.url = "github:nixos/nixpkgs";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
dbmlSQLite = {
|
|
||||||
url = "github:maix0/DBML_SQLite";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
dbmlSQLite,
|
|
||||||
}:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (
|
flake-utils.lib.eachDefaultSystem (
|
||||||
system: let
|
system: let
|
||||||
|
|
@ -44,7 +39,6 @@
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
act
|
act
|
||||||
clang
|
clang
|
||||||
dbmlSQLite.packages.${system}.default
|
|
||||||
gnumake
|
gnumake
|
||||||
lazydocker
|
lazydocker
|
||||||
nodejs_22
|
nodejs_22
|
||||||
|
|
@ -64,7 +58,6 @@
|
||||||
export PODMAN_COMPOSE_WARNING_LOGS="false";
|
export PODMAN_COMPOSE_WARNING_LOGS="false";
|
||||||
export DATABASE_DIR="$(realpath .)/db"
|
export DATABASE_DIR="$(realpath .)/db"
|
||||||
mkdir -p $DATABASE_DIR
|
mkdir -p $DATABASE_DIR
|
||||||
export JWT_SECRET="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue