Merge branch 'master' of https://codefirst.iut.uca.fr/git/Crypteam/Cryptid into newProfil
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
97f3d45472
@ -0,0 +1,22 @@
|
|||||||
|
FROM node:14
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
#
|
||||||
|
# Installez express
|
||||||
|
RUN npm install express
|
||||||
|
|
||||||
|
# Copiez le script serveur personnalisé
|
||||||
|
COPY server.js .
|
||||||
|
|
||||||
|
# Commande pour démarrer le serveur personnalisé
|
||||||
|
CMD ["node", "server.js"]
|
@ -0,0 +1,9 @@
|
|||||||
|
<FilesMatch "\.css$">
|
||||||
|
ForceType text/css
|
||||||
|
Header set Content-Type "text/css"
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
<FilesMatch "\.js$">
|
||||||
|
ForceType application/javascript
|
||||||
|
Header set Content-Type "application/javascript"
|
||||||
|
</FilesMatch>
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"headers": [
|
||||||
|
{ "source": "**/*.js", "headers": [{ "key": "Content-Type", "value": "application/javascript; charset=utf-8" }] }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const port = process.env.PORT || 80;
|
||||||
|
|
||||||
|
// Servir les fichiers statiques depuis le dossier 'build'
|
||||||
|
app.use(express.static(path.join(__dirname, 'build')));
|
||||||
|
|
||||||
|
// Définir le type MIME pour les fichiers JavaScript
|
||||||
|
app.use('*.js', (req, res, next) => {
|
||||||
|
res.type('application/javascript; charset=utf-8');
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Route par défaut pour servir l'application React
|
||||||
|
app.get('*', (req, res) => {
|
||||||
|
res.sendFile(path.join(__dirname, 'build', 'index.html'));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Démarrer le serveur
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`Serveur en cours d'exécution sur le port ${port}`);
|
||||||
|
});
|
Loading…
Reference in new issue