Open Bedrock02 opened 5 years ago
@Bedrock02 Hi, since canner:serve
is using https://github.com/webpack/webpack-dev-server to create local server for local development. Since we are not really familiar with docker, so we didn't know why this is not working right.
If you are trying to hosting a web server that hosting Canner CMS you should consider using https://www.canner.io/docs/guides-community-intro.html our Canner component to host within your web server. Which will be the same as how you setup other web servers.
@Bedrock02 , did you get it to work with docker?
With some help from comments in the issue cli: No such file or directory #118 I have found a solution to your question.
You must install version 2.6.3 of @canner/cli . I found that it error'd if installed globally so it's set as a dependancy in package.json
The command canner script:serve /app/schema/canner.schema.js --host 0.0.0.0 --port 9090
is used to start the serve. Setting the host to 0.0.0.0 is important for docker to expose the port.
My files are below. Once you have these, docker-compose up
works.
version: '3'
services:
app:
build: .
ports:
- "9090:9090"
volumes:
- ./schema:/app/schema
FROM node:6
WORKDIR /app
COPY ./package.json /app
EXPOSE 9090
COPY ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
#!/bin/sh
npm install
npm start
{
"name": "docker-sample",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "canner script:serve /app/schema/canner.schema.js --host 0.0.0.0 --port 9090"
},
"dependencies": {
"@canner/cli": "2.6.3"
}
}
/** @jsx builder */
import builder from "canner-script";
export default (
<root>
<object keyName="info">
<string keyName="name" />
</object>
</root>
);
I am trying to set a docker container for my canner project. Locally when I serve on my computer I see
Starting CMS server on http://localhost:9090
However within the docker container I see everything except for that it is serving on 9090
docker-compose.yml
Dockerfile
docker-compose up --build