'Docker node and postgres in 1 container

I want to deploy my app on heroku so I wont be able to use more than one container. I want to run a postgres sql server and a node webserver at the same time in one container.

I tried this:

FROM node:12-alpine
WORKDIR /football_marketplace
COPY . .
RUN npm install -g pg
RUN apk add nano
USER postgres
CMD ["npm", "start"]

but when I try to use "psql" inside the container, it says that the command doesnt exist.

How would one do this?

All tutorials on the web show how to dockerize postgres with docker compose, but none of them show how I can do node and postgres in one container.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source