Skip to content

Commit

Permalink
[AM-46] deploy: OCI migration
Browse files Browse the repository at this point in the history
- new 404 page
  • Loading branch information
castevinz authored Apr 11, 2024
1 parent 26424a1 commit e841c6a
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 15 deletions.
53 changes: 43 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
name: Automatic deployment
name: Automatic deployments

on:
workflow_dispatch:
push:
tags:
- '*'


# GLOBAL ENVIRONMENT VARIABLES
env:
SFTP_HOSTNAME: ${{ secrets.SFTP_HOSTNAME }}
SFTP_PORT: ${{ secrets.SFTP_PORT }}
SFTP_USER: ${{ secrets.SFTP_USER }}
SFTP_PASSWORD: ${{ secrets.SFTP_PASSWORD }}
SFTP_REMOTE_PATH: '/home/${{ secrets.SFTP_USER }}/www'
OCI_TENANCY_NS: axkiihq3lcps
OCI_REGISTRY: eu-paris-1.ocir.io
OCI_REPOSITORY: grenadille/website
OCI_GITHUB_USERNAME: ${{ secrets.OCI_GITHUB_USERNAME }}
OCI_GITHUB_PASSWORD: ${{ secrets.OCI_GITHUB_PASSWORD }}
DOCKERFILE: docker/Dockerfile

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Cache node modules
uses: actions/cache@v2
Expand All @@ -39,10 +44,38 @@ jobs:
- name: Deploy
uses: wlixcc/[email protected]
with:
username: ${{ env.SFTP_USER }}
port: ${{ env.SFTP_PORT }}
server: ${{ env.SFTP_HOSTNAME }}
password: ${{ env.SFTP_PASSWORD }}
local_path: './dist/*'
remote_path: ${{ env.SFTP_REMOTE_PATH }}
sftp_only: true
username: ${{ env.SFTP_USER }}
port: ${{ env.SFTP_PORT }}
server: ${{ env.SFTP_HOSTNAME }}
password: ${{ env.SFTP_PASSWORD }}
local_path: './dist/*'
remote_path: ${{ env.SFTP_REMOTE_PATH }}
sftp_only: true

deploy-oci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to OCIR
uses: docker/login-action@v3
with:
registry: ${{ env.OCI_REGISTRY }}
username: ${{ env.OCI_TENANCY_NS }}/${{ env.OCI_GITHUB_USERNAME }}
password: ${{ env.OCI_GITHUB_PASSWORD }}

- name: Set variables
run: |
echo "REPOSITORY=${{ env.OCI_REGISTRY }}/${{ env.OCI_TENANCY_NS }}/${{ env.OCI_REPOSITORY }}" >> $GITHUB_ENV
- name: Build and push Docker image with latest tag
run: |
DOCKER_BUILDKIT=1 docker build -f ${{ env.DOCKERFILE }} -t ${{ env.REPOSITORY }}:latest .
docker push ${{ env.REPOSITORY }}:latest
- name: Add version tag
if: startsWith(github.ref, 'refs/tags/')
run: |
docker tag ${{ env.REPOSITORY }}:latest ${{ env.REPOSITORY }}:${GITHUB_REF#refs/tags/}
docker push ${{ env.REPOSITORY }}:${GITHUB_REF#refs/tags/}
13 changes: 13 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:21-alpine as builder
RUN mkdir -p /app
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM nginx:alpine as runner
COPY --from=builder /app/dist /usr/share/nginx/html
COPY --from=builder /app/docker/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
16 changes: 16 additions & 0 deletions docker/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
server {
listen 80;
server_name www.grenadille.app;

client_body_temp_path /tmp/client_body_temp;
proxy_temp_path /tmp/proxy_temp;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;

location / {
root /usr/share/nginx/html;
index index.html;
error_page 404 404.html;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"start": "parcel 'src/*.html' --lazy --open",
"build": "npm run build:clean && npm run build:dist",
"build:dist": "parcel build && cp -fv src/robots.txt src/favicon.ico dist/ && cp -fv src/assets/img/icons/logo.png dist/logo-grenadille.png",
"build:dist": "parcel build 'src/*.html' && cp -fv src/robots.txt src/favicon.ico dist/ && cp -fv src/assets/img/icons/logo.png dist/logo-grenadille.png",
"build:clean": "rm -Rf dist .parcel-cache"
},
"devDependencies": {
Expand Down
71 changes: 71 additions & 0 deletions src/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="fr-FR">
<head>
<title>Grenadille. - Not Found</title>
<meta name="robots" content="noindex,follow,noarchive">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="google" content="notranslate">
<meta name="google" content="nopagereadaloud">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="icon" type="image/png" sizes="32x32" href="assets/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/img/icons/favicon-16x16.png">
<link rel="apple-touch-icon" sizes="180x180" href="assets/img/icons/apple-touch-icon.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="assets/img/icons/safari-pinned-tab.svg" color="#e84254">
<meta name="msapplication-TileColor" content="#e84254">
<meta name="theme-color" content="#ffffff">
<meta property="og:url" content="https://grenadille.app/404.html">
<meta property="og:type" content="website">
<meta property="og:title" content="Grenadille. - Not Found">
<meta property="og:image" content="https://grenadille.app/logo-grenadille.png">
<meta name="twitter:image" content="https://grenadille.app/logo-grenadille.png">
<meta property="og:locale" content="fr_FR">
<link rel="canonical" href="https://grenadille.app/404.html">
<link rel="stylesheet" href="sass/styles.scss">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-BRV589QKPZ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-BRV589QKPZ');
</script>
<!-- Clarity tracking code for https://grenadille.app/ -->
<script>
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i+"?ref=bwt";
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "gzelpkx8bs");
</script>
</head>
<body>
<header>
<div class="container">
<a href="index.html" class="brand">
<h1><img src="assets/img/brand.png" alt="Grenadille." /></h1>
<h2>404 - Not Found !</h2>
</a>
</div>
</header>
<div class="content">
<div class="container">
<h4>Désolé, la page que tu recherches n'existe pas.</h4>
<div class="button-wrapper">
<a class="primary" href="index.html">
<span>Retour à l'accueil</span>
<span>
<svg width="66px" height="43px" viewBox="0 0 66 43" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="arrow" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path class="one" d="M40.1543933,3.89485454 L43.9763149,0.139296592 C44.1708311,-0.0518420739 44.4826329,-0.0518571125 44.6771675,0.139262789 L65.6916134,20.7848311 C66.0855801,21.1718824 66.0911863,21.8050225 65.704135,22.1989893 C65.7000188,22.2031791 65.6958657,22.2073326 65.6916762,22.2114492 L44.677098,42.8607841 C44.4825957,43.0519059 44.1708242,43.0519358 43.9762853,42.8608513 L40.1545186,39.1069479 C39.9575152,38.9134427 39.9546793,38.5968729 40.1481845,38.3998695 C40.1502893,38.3977268 40.1524132,38.395603 40.1545562,38.3934985 L56.9937789,21.8567812 C57.1908028,21.6632968 57.193672,21.3467273 57.0001876,21.1497035 C56.9980647,21.1475418 56.9959223,21.1453995 56.9937605,21.1432767 L40.1545208,4.60825197 C39.9574869,4.41477773 39.9546013,4.09820839 40.1480756,3.90117456 C40.1501626,3.89904911 40.1522686,3.89694235 40.1543933,3.89485454 Z" fill="#FFFFFF"></path>
<path class="two" d="M20.1543933,3.89485454 L23.9763149,0.139296592 C24.1708311,-0.0518420739 24.4826329,-0.0518571125 24.6771675,0.139262789 L45.6916134,20.7848311 C46.0855801,21.1718824 46.0911863,21.8050225 45.704135,22.1989893 C45.7000188,22.2031791 45.6958657,22.2073326 45.6916762,22.2114492 L24.677098,42.8607841 C24.4825957,43.0519059 24.1708242,43.0519358 23.9762853,42.8608513 L20.1545186,39.1069479 C19.9575152,38.9134427 19.9546793,38.5968729 20.1481845,38.3998695 C20.1502893,38.3977268 20.1524132,38.395603 20.1545562,38.3934985 L36.9937789,21.8567812 C37.1908028,21.6632968 37.193672,21.3467273 37.0001876,21.1497035 C36.9980647,21.1475418 36.9959223,21.1453995 36.9937605,21.1432767 L20.1545208,4.60825197 C19.9574869,4.41477773 19.9546013,4.09820839 20.1480756,3.90117456 C20.1501626,3.89904911 20.1522686,3.89694235 20.1543933,3.89485454 Z" fill="#FFFFFF"></path>
<path class="three" d="M0.154393339,3.89485454 L3.97631488,0.139296592 C4.17083111,-0.0518420739 4.48263286,-0.0518571125 4.67716753,0.139262789 L25.6916134,20.7848311 C26.0855801,21.1718824 26.0911863,21.8050225 25.704135,22.1989893 C25.7000188,22.2031791 25.6958657,22.2073326 25.6916762,22.2114492 L4.67709797,42.8607841 C4.48259567,43.0519059 4.17082418,43.0519358 3.97628526,42.8608513 L0.154518591,39.1069479 C-0.0424848215,38.9134427 -0.0453206733,38.5968729 0.148184538,38.3998695 C0.150289256,38.3977268 0.152413239,38.395603 0.154556228,38.3934985 L16.9937789,21.8567812 C17.1908028,21.6632968 17.193672,21.3467273 17.0001876,21.1497035 C16.9980647,21.1475418 16.9959223,21.1453995 16.9937605,21.1432767 L0.15452076,4.60825197 C-0.0425130651,4.41477773 -0.0453986756,4.09820839 0.148075568,3.90117456 C0.150162624,3.89904911 0.152268631,3.89694235 0.154393339,3.89485454 Z" fill="#FFFFFF"></path>
</g>
</svg>
</span>
</a>
</div>
</div>
</div>
</body>
</html>
6 changes: 2 additions & 4 deletions src/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ User-agent: *
Disallow: /
# Assets
Allow: /site.webmanifest$
Allow: /*.ico$
Allow: /*.css$
Allow: /*.png$
Allow: /*.svg$
Allow: /favicon.ico$
Allow: /logo-grenadille.png$
# Home
Allow: /$
Allow: /index.html$

0 comments on commit e841c6a

Please sign in to comment.