Version 1.3.0 - Ajout de Docker

This commit is contained in:
2025-10-04 17:07:05 +02:00
parent ea9cf2ce42
commit d06c758763
6 changed files with 50 additions and 60 deletions

View File

@@ -1,57 +0,0 @@
name: Frontend Deployment
on:
push:
branches:
- main
jobs:
deploy-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H alpha.raphix.fr >> ~/.ssh/known_hosts
- name: Deploy frontend
run: |
ssh raphix@alpha.raphix.fr "
set -e;
APP_DIR=/home/gitlab-ci/chopin-frontend;
FRONTEND_DIR=/home/gitlab-ci/frontend/dist;
REPO_URL=https://git.raphix.fr/subsonics/chopin-frontend;
BRANCH=main;
echo '[Frontend-Deploy] - START';
# Nettoyage ancien dossier temporaire
rm -rf \$APP_DIR;
mkdir -p \$APP_DIR;
echo 'Cloning repository...';
git clone -b \$BRANCH \$REPO_URL \$APP_DIR;
cd \$APP_DIR;
echo 'Installing dependencies...';
npm ci;
echo 'Building app...';
npm run build;
echo 'Deploying build to frontend/dist...';
mkdir -p \$FRONTEND_DIR;
rm -rf \$FRONTEND_DIR/*;
cp -r dist/* \$FRONTEND_DIR/;
echo 'Cleaning up temporary build directory...';
rm -rf \$APP_DIR;
echo '[Frontend-Deploy] - DONE';
"

22
Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
FROM node:lts-alpine
# installe un simple serveur http pour servir un contenu statique
RUN npm install -g http-server
# définit le dossier 'app' comme dossier de travail
WORKDIR /app
# copie 'package.json' et 'package-lock.json' (si disponible)
COPY package*.json ./
# installe les dépendances du projet
RUN npm install
# copie les fichiers et dossiers du projet dans le dossier de travail (par exemple : le dossier 'app')
COPY . .
# construit l'app pour la production en la minifiant
RUN npm run build
EXPOSE 4001
CMD [ "http-server", "dist" ]

16
docker-compose.yml Normal file
View File

@@ -0,0 +1,16 @@
version: "3.9"
services:
subsonics-frontend:
build:
context: . # dossier contenant ton Dockerfile et ton code
dockerfile: Dockerfile
container_name: subsonics-frontend
ports:
- "4001:4001"
volumes:
- subsonics-frontend:/app/dist
restart: unless-stopped
volumes:
subsonics-frontend:

View File

@@ -8,5 +8,14 @@
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.js"></script> <script type="module" src="/src/main.js"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-G0X9BNYZ6W"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-G0X9BNYZ6W');
</script>
</body> </body>
</html> </html>

View File

@@ -1,6 +1,6 @@
{ {
"name": "chopin-frontend", "name": "chopin-frontend",
"version": "1.2.0", "version": "1.3.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite --host --port 8080", "dev": "vite --host --port 8080",

View File

@@ -1,10 +1,10 @@
{ {
"discord": { "discord": {
"development": "https://discord.com/oauth2/authorize?client_id=1342913183744004158&response_type=code&redirect_uri=http%3A%2F%2F192.168.1.77%3A8080%2Fredirect&scope=identify", "development": "https://discord.com/oauth2/authorize?client_id=1342913183744004158&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fredirect&scope=identify",
"production": "https://discord.com/oauth2/authorize?client_id=1094727789682380922&response_type=code&redirect_uri=https%3A%2F%2Fsubsonics.raphix.fr%2Fredirect&scope=identify" "production": "https://discord.com/oauth2/authorize?client_id=1094727789682380922&response_type=code&redirect_uri=https%3A%2F%2Fsubsonics.raphix.fr%2Fredirect&scope=identify"
}, },
"backend": { "backend": {
"development": "http://192.168.1.77:3000", "development": "http://localhost:3000",
"production": "https://backend.subsonics.raphix.fr" "production": "https://backend.subsonics.raphix.fr"
}, },
"bot_invite": { "bot_invite": {