Skip to content

Create Dockerfile #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Create Dockerfile #303

wants to merge 1 commit into from

Conversation

didierfranc
Copy link

It should be good to have a Dockerfile here to have an automated image on docker hub from the official Parse-Server repo !

@gnz00
Copy link

gnz00 commented Feb 8, 2016

It's bad practice to bake the environment variables into the image. I think @flovilmart is working on a CLI, which would make sense to use as the ENTRYPOINT.

@flovilmart
Copy link
Contributor

I'm effectively working on some CLI system and also support for multiple apps and cloud code instances.
That is quite a big PR, as Cloud Code needed to run in subprocess to have proper isolation.

As a good side effect, we now have automated hooks registration upon declaration :)
The docker file should have

COPY ./config.json config.json
RUN npm start -- --config ./config.json

@gnz00
Copy link

gnz00 commented Feb 9, 2016

@flovilmart I'd say even doing a COPY of a secrets file into the image would be risky. You should b
build the image and then supply the secrets during docker run. I think it'd be cool if the Dockerfile used a CLI:

ENTRYPOINT ['bin/cli']
# Default CMD
CMD ['start', '--config default.json']

You can then pass commands to the image on dockerhub, i.e.

// Pass in config as environment variables
docker run parse-server:latest start -ddatabaseURI=mongodb://databasehost.com/12345
// Load config from S3 bucket
docker run parse-server:latest start --config s3://mybucket.amazons3.com/configs/1.json?signature=XXX
// Pass configs as JSON string
docker run parse-server:latest start --config "{appId: 12345, databaseURI: mongodb://databasehost.com/12345'}"
// Mount configs from local
docker run -v /configs:/var/app/configs/ parse-server:latest start --config /var/app/configs/main.json

Could launch an instance of the server with 1 line. If you're feeling ambitious, the CLI could also manage installing/registering Parse modules, similar to how the Ember CLI does.

@flovilmart
Copy link
Contributor

@mysale01, I'm pretty new to docker, and yes copy the config.json is not possible as for the base image as it's not there :)

As of today, the base CLI is there on master under bin/parse-server with the support of environment.

@facebook-github-bot
Copy link

@didierfranc updated the pull request.

1 similar comment
@facebook-github-bot
Copy link

@didierfranc updated the pull request.

@gfosco
Copy link
Contributor

gfosco commented Feb 12, 2016

Can we create a contrib/ folder and move this in there (and update it to work from the subfolder)? Supportive of the idea, but not sure we want to commit to supporting it / testing it / ensuring it doesn't break in the future.

@gnz00
Copy link

gnz00 commented Feb 12, 2016

Docker files have to be run at the project root because only subdirectories
are included in the docker context. I don't think this is production worthy
at the moment, the environment variables need to be removed. It should
essentially just be a 3 line file to run NPM install and have a default
command like "forever bin/server".

On Friday, February 12, 2016, Fosco Marotto [email protected]
wrote:

Can we create a contrib/ folder and move this in there (and update it to
work from the subfolder)? Supportive of the idea, but not sure we want to
commit to supporting it / testing it / ensuring it doesn't break in the
future.


Reply to this email directly or view it on GitHub
#303 (comment)
.

@flovilmart
Copy link
Contributor

👍 @maysale01

@gfosco
Copy link
Contributor

gfosco commented Feb 12, 2016

In that case, we'll close this. If there's use in having a simpler one, let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants