This repository has been archived by the owner on Apr 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from louis-antoine-etsmtl/serveur-frontend
Setup docker et pipeline
- Loading branch information
Showing
6 changed files
with
814 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Deploy Frontend | ||
|
||
on: | ||
push: | ||
branches: | ||
- serveur-frontend | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image for Frontend | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Étape de build | ||
FROM node:18 AS build | ||
|
||
# Définir le répertoire de travail dans le conteneur | ||
WORKDIR /app | ||
|
||
# Copier les fichiers 'package.json' et 'package-lock.json' (ou 'yarn.lock') | ||
COPY package*.json ./ | ||
|
||
# Installer les dépendances du projet | ||
RUN npm install | ||
|
||
# Copier le reste des fichiers du projet dans le conteneur | ||
COPY . . | ||
|
||
# Créer le fichier .env avec les variables d'environnement nécessaires | ||
RUN echo "VITE_BACKEND_URL=http://10.196.10.69:4400/\nVITE_AZURE_BACKEND_URL=http://10.196.10.69:4400" > .env | ||
|
||
# Exécuter le script de build du projet | ||
RUN npm run build | ||
|
||
# Étape de serveur NGINX pour servir l'application | ||
FROM nginx:stable-alpine as serve | ||
|
||
# Copier les fichiers statiques depuis l'étape de build | ||
COPY --from=build /app/dist /usr/share/nginx/html | ||
|
||
# Copier la configuration Nginx personnalisée dans le conteneur | ||
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf | ||
|
||
# Exposer le port 80 | ||
EXPOSE 80 | ||
|
||
# Lancer NGINX | ||
CMD ["nginx", "-g", "daemon off;"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# To run this project | ||
# To run this project | ||
# test demo | ||
|
||
First install with: `npm install` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
server { | ||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} | ||
|
Oops, something went wrong.