teleprompter icon indicating copy to clipboard operation
teleprompter copied to clipboard

Docker File

Open mmBesar opened this issue 4 years ago • 3 comments

Amazing Application, thanks!

I do not code, but I need to self-host my services and applications, due to poor internet service! But I failed to build a docker image for it! Please Guide me! What am I doing wrong here!

Regards

Here is my docker file:

FROM node:12.22.6-alpine

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
RUN apk add --update git
RUN git clone https://github.com/manifestinteractive/teleprompter.git /usr/src/app
RUN apk del git

# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

ENV PORT=8080
ENV PORT=3000

EXPOSE 8080
EXPOSE 3000
CMD [ "npm", "start" ]

mmBesar avatar Sep 12 '21 19:09 mmBesar

I've just tried to do this too — what's wrong is npm start immediately demonises into the background (due to the use of forever, see package.json), causing the container to exit immediately. The fix is to change your CMD to be CMD ["npm", "run", "server"], which blocks.

You'll actually need to run two containers, one for the client and one for the remote ("server"). I would suggest removing CMD altogether and instead using ENTRYPOINT:

# Dockerfile
FROM node
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN npm install
EXPOSE 3000
EXPOSE 8080
ENTRYPOINT ["npm", "run"]
CMD ["server"]
# docker-compose.yml
services:
  server:
    build: .
    command: server
    ports:
      - '3000:3000'
  client:
    build: .
    command: client
    ports:
      - '8080:8080'
docker compose up

The DEVELOPERS.md file mentions the correct way to deploy this project is behind a reverse proxy like nginx, but the docker/compose files above were good enough for me to get running in development mode, quite enough to have the project running across a local network.

mcoms avatar Jan 02 '22 23:01 mcoms

Seems like you've actually got a fix in place. If you wouldn't mind submitting that as a PR, I'd happily merge your changes :)

manifestinteractive avatar Jan 03 '22 00:01 manifestinteractive

That is why open source is great.
I'll try it as soon as I can and report back.
@mcoms @manifestinteractive Thank you.

mmBesar avatar Jan 04 '22 14:01 mmBesar