create-elm-app icon indicating copy to clipboard operation
create-elm-app copied to clipboard

Update the documentation

Open halfzebra opened this issue 7 years ago • 4 comments

This issue is tracking the documentation that has to be updated.

halfzebra avatar Sep 04 '18 14:09 halfzebra

Hi, not sure if this is the best place, but I just set up yet another create-elm-app project (and loving it) and thought you might like to add a minimal Docker setup to the docks. I can make a PR if you are interested. It's basically this:

FROM node:10-slim as dev

WORKDIR /app
RUN npm config set unsafe-perm true
RUN npm install -g create-elm-app

COPY . /app
CMD bash -c "rm -rf elm-stuff/ && elm-app start"
version: "3.4"

services:
  web:
    build:
      context: .
      target: dev
    volumes:
      - ".:/app:cached"
    ports:
      - 3000:3000

Might help someone.

MrMovl avatar May 08 '19 07:05 MrMovl

Hello Tomke!

Thanks for the suggestion, it sounds like a good idea and I think it deserves a separate issue. I'm afraid I can not advise using elm-app start for serving it because this is not intended for production.

I'd recommend using a static server inside a separate stage, which does not have create-elm-app installed.

I haven't tested this, but it would be the approach I would look into:

FROM node:10-slim as builder

WORKDIR /app

RUN npm config set unsafe-perm true && \
    npm install -g create-elm-app

COPY . /app

RUN elm-app build

FROM node:10-slim

# Install the static file server
RUN npm install -g serve

# Copy the build artifacts
COPY --from=builder /app/build /app

CMD serve -s app

This would give us a slightly smaller image for production use. Please let me know what you think!

A PR would be very welcome!

@MrMovl

halfzebra avatar May 08 '19 11:05 halfzebra

I'm afraid I can not advise using elm-app start for serving it because this is not intended for production

Oh god no, you are right of course. That is just a local dev setup. For a production docker build we use another container and use elm-app build for that. Similar to your version.

I'll make a PR when I got the time (hopefully soon). Thanks for the Input!

MrMovl avatar May 10 '19 12:05 MrMovl

Also you shouldn't use sudo to install package globally, setting the global prefix to a folder in your $HOME in your npm config will do the trick.

damien-biasotto avatar Apr 08 '20 01:04 damien-biasotto