Local development with docker compose, based on #401, closes #401

This commit is contained in:
Milos Stojanovic 2024-04-18 12:22:19 +02:00
parent ebc82d9108
commit e195d19a46
4 changed files with 45 additions and 2 deletions

19
Dockerfile.dev Normal file
View File

@ -0,0 +1,19 @@
FROM php:7-buster
RUN apt-get update > /dev/null
RUN apt-get install -y nodejs npm libzip-dev libgtk2.0-0 libgtk-3-0 libgbm-dev libldap2-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/
RUN docker-php-ext-install zip ldap
RUN docker-php-ext-enable zip ldap
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR "/var/www/filegator/"
COPY . .
RUN composer install
RUN npm i
RUN cp -n configuration_sample.php configuration.php
CMD ["nohup", "bash", "-c", "npm run serve"]

View File

@ -110,6 +110,19 @@ Precompiled build is created for non-developers. In this version, the frontend (
[Download & install instructions](https://docs.filegator.io/install.html)
## Project setup for development (Docker)
```
git clone https://github.com/filegator/filegator.git
cd filegator
docker compose -f docker-compose-dev.yml up
```
Once everything is ready visit: `http://localhost:8080`, Ctrl+c to stop.
If you're tweaking dependencies then you must rebuild with:
```
docker compose -f docker-compose-dev.yml up --build
```
## Project setup for development (Linux)
@ -126,7 +139,6 @@ npm install
npm run build
```
## Compiles and hot-reloads
The following command will launch backend and frontend on ports 8081 and 8080:

12
docker-compose-dev.yml Normal file
View File

@ -0,0 +1,12 @@
services:
filegator:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "8080:8080" # frontend port, see package.json
- "8081:8081" # backend port, see package.json and .env.local
volumes:
- ./frontend:/var/www/filegator/frontend
- ./backend:/var/www/filegator/backend
#- ./configuration.php:/var/www/filegator/frontend/configuration.php

View File

@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "concurrently \"php -S localhost:8081\" \"vue-cli-service serve\"",
"serve": "concurrently \"php -S 0.0.0.0:8081\" \"vue-cli-service serve --port 8080\"",
"build": "vue-cli-service build --no-clean",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e --headless",