Skip to content

Commit

Permalink
Added required files for Docker image build with GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLeChat committed Jun 8, 2024
1 parent e1bde1b commit b0c5f9f
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**/*.md
**/.git*
**/.dockerignore
**/.editorconfig
**/.gitattributes
**/node_modules
**/Dockerfile
**/docker-*
**/CODEOWNERS
**/LICENSE
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# syntax=docker/dockerfile:1

# Use an customized image of Node.js
# https://hub.docker.com/_/node
FROM node:lts-alpine

# Set the working directory to the website files
WORKDIR /usr/src/app

# Change permissions of the working directory
RUN chown node:node .

# Copy all files required to build the project
COPY --chown=node:node . .

# Install all dependencies
# Use cache mount to speed up installation of existing dependencies
RUN --mount=type=cache,target=.npm \
npm set cache .npm && \
npm install && chown -R node:node ./node_modules

# Use non-root user
USER node

# Run the website
CMD [ "npm", "run", "dev", "--", "--host", "0.0.0.0" ]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

Ce projet est un petit site Internet conçu sous forme de page d'accueil pour les utilisateurs cherchant à avoir un accès rapide vers mes projets les plus aboutis. Il sert également de porte d'entrée vers mon [Portfolio](https://github.com/FlorianLeChat/Portfolio). Comme vous avez pu le deviner, l'apparence générale du site Internet est lourdement inspirée de [craig-feldman/personal-website-react](https://github.com/craig-feldman/personal-website-react) et [perverse/vue-terminal-homepage](https://github.com/perverse/vue-terminal-homepage), le style est très orienté comme pour simuler un *vrai* terminal de commande sous Linux. Néanmoins, j'ai pris soin d'ajouter ma propre touche personnelle et d'utiliser des technologies différentes pour le développement de ce projet.

> [!TIP]
> Pour tester le projet, vous devez être en posession de [Docker](https://www.docker.com/). Une fois installé, il suffit de lancer l'image Docker de développement à l'aide de la commande `docker compose up --detach --build`. Le site devrait être accessible à l'adresse suivante : https://localhost:5173/. Si vous souhaitez travailler sur le projet avec Docker, vous devez utiliser la commande `docker compose watch --no-up` pour que vos changements locaux soient automatiquement synchronisés avec le conteneur. 🐳
> [!WARNING]
> L'entièreté du code de ce projet est commenté dans ma langue natale (en français) et n'est pas voué à être traduit en anglais par soucis de simplicité de développement.
Expand All @@ -13,6 +16,9 @@ ___

This project is a small website designed as a homepage for users looking for quick access to my most advanced projects. It also serves as a gateway to my [Portfolio](https://github.com/FlorianLeChat/Portfolio). As you may have guessed, the overall layout of the website is heavily inspired by [craig-feldman/personal-website-react](https://github.com/craig-feldman/personal-website-react) and [perverse/vue-terminal-homepage](https://github.com/perverse/vue-terminal-homepage), the style being very oriented to simulate a *real* Linux command terminal. However, I took care to add my own personal touch and to use different technologies for the development of this project.

> [!TIP]
> To try the project, you must have [Docker](https://www.docker.com/) installed. Once installed, simply start the development Docker image with `docker compose up --detach --build` command. The website should be available at https://localhost:5173/. If you want to work on the project with Docker, you need to use `docker compose watch --no-up` to automatically synchronize your local changes with the container. 🐳
> [!WARNING]
> The whole code of this project is commented in my native language (in French) and will not be translated in English for easier programming.
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: homepage

services:
# https://github.com/FlorianLeChat/Homepage
node:
image: homepage
restart: always
develop:
watch:
- action: sync
path: .
target: /usr/src/app
healthcheck:
test: wget --no-check-certificate -O - https://127.0.0.1:5173
retries: 3
timeout: 5s
build:
context: .
dockerfile: ./Dockerfile
ports:
- "5173:5173"

0 comments on commit b0c5f9f

Please sign in to comment.