Closed mmBesar closed 1 year ago
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.
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 :)
That is why open source is great.
I'll try it as soon as I can and report back.
@mcoms @manifestinteractive Thank you.
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: