viliusle / miniPaint

online image editor
http://viliusle.github.io/miniPaint/
Other
2.73k stars 632 forks source link

add Dockerfile to miniPaint #359

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello, folks!

This is my first pull-request. I added a Dockerfile from: https://github.com/bluenevus/docker-minipaint

what is Docker? Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications.

what is Dockerfile? Dockerfile is a text document containing all the commands the user requires to call on the command line to assemble an image. With the help of a Dockerfile, users can create an automated build that executes several command-line instructions in succession.

why Dockerfile? Docker can build images automatically by reading the instructions from a Dockerfile . A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.

did you develop and create this config file? No. The config file was not created by me, but by bluenevus/docker-minipaint

why are you collaborating, helping or maintaining this repository or source code?

viliusle commented 1 year ago

Can somebody with Docker knowledge review this?

ghost commented 1 year ago

Hi viliusle.

Can somebody with Docker knowledge review this?

You can check out more information on the Docker Discourse community or in documentations like Dockerfile reference. It has an open issue here: Does it work? and the source code here too bluenevus/docker-minipaint

So it is possible to test this type of file with Codespaces I think

Dev Containers let you run any project in a Docker container. You can do this locally, as we've seen, or you can do it remotely in the cloud using Github's Codespaces.

Ange-Cesari commented 1 year ago

Hi Ghost and viliusle.

I do have docker knowledge, and it looks not shocking to me. You could make some arrangements, but i'm curious about the centos choice. Why would you use a centos more than an alpine as base image for example ?

The requirements are npm and git. For security purposes you could add the dependencies (and sub dependencies) at the build.

CreativeCactus commented 1 year ago

I'm not really a fan of this Dockerfile, but I came here because I am happy to see someone contributed it. I will rewrite it now. Thanks for miniPaint, btw!

ghost commented 1 year ago

Hello eveyone!

I'm thinking of helping, I'm thinking of configuring multiple deployment instances: GitHub Pages, GitLab Pages, Codeberg Pages, Vercel, Codespaces, Repl-it, Netlify, Render, Goorm-Ide in miniPaint.

What do you all think of this idea? Is it something interesting or useful for you all?

Ange-Cesari commented 1 year ago

Hey,

I wrote a minimalist dockerfile to run miniPaint via docker container.

Simply follow these steps to generate the image yourself:

pre-requesite : docker & git

Step 1 : Go into a folder on your local machine and git clone the miniPaint project:

git clone https://github.com/viliusle/miniPaint.git

Step 2 : Create a dockerfile at the root folder of the project and paste the following code :

#Written by Ange Cesari
# Use official Node.js based on Alpine
FROM node:16-alpine

# Create dir for application
WORKDIR /usr/src/app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm i

# Copy the rest of the application code
COPY . .

# Expose the port the application will run on
EXPOSE 8080

# Run the application
CMD ["npm", "run", "server"]

Step 3 : Build the image :

docker build -t minipaint .

Step 4 : Once i'ts built, run the container and bind the ports :

docker run -d -p 8080:8080 --name minipaint-container minipaint

Step 5 : Once the container is started, you should be able to reach http://localhost:8080

viliusle commented 1 year ago

Thank you for contributions.

I added all provided solutions into wiki, so everybody can find it easily. There are multiple versions, so I don't want to move it to main code yet.

https://github.com/viliusle/miniPaint/wiki/Docker

ghost commented 1 year ago

Hi all. Please, add docker files miniPaint in Dockerfiles