hello,
from the bpmn-examples I want to run the custom-elements example in a docker container. For that I already installed docker in my Linux-OS and I have created a Dockerfile and docker-compose.yml
Dockerfile looks as follows:
FROM node:latest
WORKDIR /usr/src/app
ADD . .
COPY package.json .
COPY Gruntfile.js .
COPY .babelrc .
COPY .gitignore .
COPY .npmrc .
RUN npm install
COPY . /usr/src/app
COPY . ./
# replace this with your application's default port
EXPOSE 8000
CMD [ "npm", "run dev" ]
are the files correct? In Gruntfile.js I have set the port to 8000, therefore I did the same in the docker files. How can I start the docker-container, if they are correct ? It should finally be reachable on: localhost:8000. This is my first try with docker, so I am absolutely beginner with it.
Thanks in advance
As @maxtru stated out, I’m not sure whether you find docker specific help here, since this project is not related to Docker. We can just try to help, but can’t give guarantees.
are the files correct?
What happens when you execute those? How is your Gruntfile look like? Can you post your code inside a CodeSandbox so we can inspect it?
# Copy node
FROM node:latest
# Create some working directory for our app
WORKDIR /usr/src/bpmn-js-custom-elements-app
# Copy the entire app to the Docker image
COPY . .
# Export the webdev port
EXPOSE 8080
# Run npm start
CMD [ "npm", "start" ]
Thank you. Do I need to set port in webpack.config, too? And can I use the same configuration with Gruntfile? I have some other projects which are configured with Gruntfile and I want to dockerize them too. Further more, I think you mean CMD[ [„npm“],[„run“],[„dev“] ] as I use dev in scripts tag?
webpack.config.js doesn’t need any change. Also note that I didn’t change the default port in the example I described. I only exposed port 8080 of the running container to the port 8080 on the host machine starting that container.
And can I use the same configuration with Gruntfile? I have some other projects which are configured with Gruntfile and I want to dockerize them too.
Sure, there is no reason why you would not be able to use grunt in a dockerized app. The configuration stays in principle the same.
Further more, I think you mean CMD[ [„npm“],[„run“],[„dev“] ] as I use dev in scripts tag?
No, in the example I described I intentionally wanted to run npm start which is the intended script in the package.json to start the example. But technically this does start the dev script anyhow, so you could also do CMD [ "npm", "run", "dev" ] with the same result.