This project uses Docker to create a container that runs the following images: Nginx, Next.js app, TUS server and a MySQL database. The Next.js app is a simple file uploader that uses the TUS server to upload files to the server. The MySQL database is used to store the file metadata and Nginx is used to serve the Next.js app and the TUS server.
- Clone the repository
- Change directory to the root of the project
cd free-space - Create project nerwork
docker network create frspc_network - Run
docker compose -f docker-compose.dev.yml upto start the development environment - Change directory to the Next.js app
cd next-app - Copy the node modules generated by dockerized Next.js to your host so you can develop without errors
sudo docker cp next-app:/app/node_modules ./node_modules - Open your browser and go to
http://localhostto see the Next.js app
After making changes to the Prisma schema:
- Update container docker compose -f docker-compose.dev.yml up --build next-app
- Go to docker containers, right click on free-space-next-app and click "Attach Shell"
- In the new shell run npx prisma db push to push the changes to mysql database
- Close the shell by running exit or CTRL+D
- Change directory to next-app by cd next-app
- Remove the node_modules by sudo rm -r node_modules
- Copy the node modules generated by dockerized Next.js to your host so you can develop without errors sudo docker cp next-app:/app/node_modules ./node_modules - this is a heavy operation, it takes ~700MB of space
- Go to docker containers, right click on free-space-next-app and click "Attach Shell"
- In the new shell run
npx prisma studio
To test the file upload functionality go to http://localhost/test
- Make sure that you are in root(free-space) directory
- Run
docker compose -f docker-compose.dev.yml up
- Make sure that you are in root(free-space) directory
- Run
docker compose -f docker-compose.dev.yml up --build