From a4e6ebf9783c8c98f4572bc695473140f2d3d92f Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Fri, 17 Nov 2023 19:57:25 +0100 Subject: [PATCH 1/7] Use docker for building/running the via app --- .dockerignore | 3 +++ Dockerfile | 21 +++++++++++++++++++++ docker-compose.yml | 15 +++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..2dfd354bf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +/node_modules +/Dockerfile +/docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..bbada1f74 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM node:21-alpine + +RUN apk update + +RUN apk upgrade + +RUN apk add jq xdg-utils + +WORKDIR /app + +COPY . . + +RUN sed -i -e 's/run dev/run dev -- --host/' package.json + +RUN npm install + +RUN npm run build:azure || true + +EXPOSE 5173 + +CMD [ "npm", "start" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..4d3c077a4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +# Run `docker-compose up` to build and run the via app in docker +version: '3.9' +services: + via: + build: + context: . + pull: true + dockerfile: Dockerfile + tags: + - via + stdin_open: true + tty: true + ports: + - "127.0.0.1:5173:5173" + depends_on: [] From e43e0cf88dfcdeb324122ab9afc136e8720237d1 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Tue, 4 Feb 2025 10:03:42 +0100 Subject: [PATCH 2/7] Update Node version in Dockerfile to **23**-alpine and modify npm start command. - Update `FROM node:21-alpine` to `FROM node:23-alpine`. - Update `RUN sed -i ... package.json` to replace `vite --force` with `vite --force --host`. - Update `CMD [ "npm", "start" ]` to `CMD [ "npm", "run", "dev" ]`. --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index bbada1f74..f1e2f2590 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:21-alpine +FROM node:23-alpine RUN apk update @@ -10,7 +10,7 @@ WORKDIR /app COPY . . -RUN sed -i -e 's/run dev/run dev -- --host/' package.json +RUN sed -i -e 's/vite --force/vite --force --host/' package.json RUN npm install @@ -18,4 +18,4 @@ RUN npm run build:azure || true EXPOSE 5173 -CMD [ "npm", "start" ] +CMD [ "npm", "run", "dev" ] From 0bf749011031e1f2dd9ee776d45286bac446a6c0 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Tue, 4 Feb 2025 11:03:50 +0100 Subject: [PATCH 3/7] Update Docker Compose configuration to use 'unless-stopped' restart policy. --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 4d3c077a4..02bd3904b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,7 @@ services: dockerfile: Dockerfile tags: - via + restart: unless-stopped stdin_open: true tty: true ports: From 273e32b301111edfb39deee66150cd96f55df5f1 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 14 Aug 2025 15:55:49 +0200 Subject: [PATCH 4/7] Removed obsolete `version: '3.9'` declaration from `docker-compose.yml` --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 02bd3904b..4e2d43a89 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,4 @@ # Run `docker-compose up` to build and run the via app in docker -version: '3.9' services: via: build: From 3c03fd643cca6990560ddb9abb188f78e0a0b40b Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 14 Aug 2025 16:18:58 +0200 Subject: [PATCH 5/7] Use Node.js **24** instead of **23** in Dockerfile - Updated base image from `node:23-alpine` to `node:24-alpine` - This changes the Node.js version used for building and running the application - The Alpine Linux variant is maintained for minimal image size --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f1e2f2590..54551728b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:23-alpine +FROM node:24-alpine RUN apk update From 5c14a500f8eed4d3b2f8ffa3f1dd83cc4f1fdc3d Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 14 Aug 2025 16:19:22 +0200 Subject: [PATCH 6/7] Add Docker Compose setup instructions to README - Added detailed instructions for running the application with Docker Compose - Included steps for starting, accessing, and stopping the application - Documented the Docker Compose configuration with Node.js **24-alpine** Alpine image - Added build instructions with `docker compose build --no-cache` - Mentioned automatic restart policy and optimized development environment --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index 173858dff..f0db71809 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,47 @@ Run with the `--watch` flag (`npm test -- --watch`) to run in interactive watch This project is tested with [BrowserStack](https://www.browserstack.com/). +## Running with Docker Compose + +To run the VIA web application using `docker compose`, follow these steps: + +1. **Prerequisites** + - [Docker](https://docs.docker.com/get-docker/) installed + - [Docker Compose](https://docs.docker.com/compose/install/) installed + +2. **Start the application** + ```bash + docker compose up + ``` + +3. **Access the application** + Open your browser and navigate to [http://localhost:5173](http://localhost:5173) + +4. **Stop the application** + ```bash + docker compose down + ``` + +### Docker Compose Configuration + +The Docker Compose setup includes: +- Node.js 24 Alpine base image +- Vite development server with host binding +- Port mapping for local development (localhost:5173) +- Automatic restart policy (`unless-stopped`) +- Optimized build process for development environment + +### Building from Source + +If you need to rebuild the container after making changes: +```bash +docker compose build --no-cache +docker compose up +``` + +This approach ensures a consistent environment and eliminates dependency issues +during local development. + ## Looking for an offline app? @cebby2420 has kindly made a desktop app that does so. From 4b7410af5a3d180d6145c6ab630ff4eaacc642b2 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 14 Aug 2025 16:50:31 +0200 Subject: [PATCH 7/7] Add dist directory to dockerignore - Added `/dist` directory to `.dockerignore` file to prevent it from being included in Docker builds - This ensures that compiled distribution files are not part of the container image - The change helps keep container images smaller and cleaner by excluding build artifacts --- .dockerignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.dockerignore b/.dockerignore index 2dfd354bf..f877c2271 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ /node_modules /Dockerfile /docker-compose.yml +/dist