Using Ember on Docker

So I just started learning Ember, and I have recently began to use Docker. I know that Ember has a web server and a deploy command. I know that the deploy command makes a directory with the files that can be uploaded to a web server.

My question is, if I want to deploy a Ember website to Docker, would it be better to setup Apache to run on Docker and use the deploy command, or just use Ember’s built-in web server? Option 2 seems better, because I don’t know how to use Apache with Docker.

Ember’s web server isn’t really meant for production use. It’s for development purposes, basically to serve your app locally and auto-reload on changes and so on. In summary I would not recommend it for a production deployment. Since the output of an ember build is simply static files you could use pretty much any web server, Apache would work great. I think I’ve seen some Apache configs floating around on these boards. I’m sure you could even write a super basic node.js webserver with very little effort.

TBH though Docker seems like overkill for serving static assets like that (though if you’re serving an API from it too it might make more sense). Deploying to AWS S3 is pretty common (it’s what we do with our apps), cheap, and easy to set up. And of course there are other static file services like it. Just my 2c. Your mileage may vary.

Oh and maybe this is what you were referring to when you referenced a deploy command but if not I highly recommend ember-cli-deploy for setting up deployments.

1 Like

Not really going to do anything for production. Just want to learn some frameworks. Would just using Express with express.static work?

EDIT: Apparently, using Apache with Docker is really easy.

Maybe I’m using Docker wrong, but the way I’m trying to use it, is to separate how I’m using my DigitalOcean droplet. I currently have a express web server running on one container that has a page that shows the current weather. Part of the reason I’m using Docker is that I found a nginx proxy that needs Docker.

That’s what I was talking about for deployment.

Ah yeah if you’re not really intending anything for “production” per se then you’ve got a lot fewer things to worry about :smile: and any of those options would probably be fine. I bet express.static would work fine but never tried it. One thing to be aware of is some webservers don’t handle the locationType: ‘auto’ setting very well so you may either have to do some fancy config or set it to “hash” (config/environment.js).

If you’re already using docker and want to deploy tthere by all means that makes plenty of sense. I more just meant if you were starting from scratch and looking for a production deployment spot it might be more trouble than it’s worth.

Anyway, hope that’s at least slightly helpful, good luck!

1 Like

We deploy to CouchDB with ember-cli-deploy-couchdb so we have data and ember App in one place. See

https://github.com/broerse/ember-cli-blog/blob/master/config/deploy.js

We use docker to run the ember server in development. In case it is helpful, here is the Dockerfile we use.

FROM danlynn/ember-cli:2.16.2

EXPOSE 4200 7357 9222
CMD ["ember server"]

ENV INSTALL_PATH /app
RUN mkdir -p $INSTALL_PATH

WORKDIR $INSTALL_PATH

COPY package.json .
COPY yarn.lock .

RUN yarn

# Copy all our app's directories
COPY . .