S
S
Spoki42017-04-13 16:15:18
Node.js
Spoki4, 2017-04-13 16:15:18

How to build a docker image?

There is a project with two folders in which frontend and backend are being developed.
/project
/project/fontend <--- frontend(React, Redux, Webpack, typescript, ...)
/project/frontend/build <--- Built frontend
/project/backend <--- backend(express.js, typescript, ...)
/project/backend/build <--- Compiled backend (transpilation from ts to js) The backend
should serve the assembled frontend from the static folder (project/backend/build/static).
As I understand it, both frontend and backend should have a Dockerfile and be able to build a docker image.
How to make docker-compose config use frontend image as volume in backend image?
Should the backend image eventually contain only the compiled version of the application? And in general, am I going to use docker correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2017-04-13
@Spoki4

Looking for what to use.
You have one node.js application, everything seems to be written here https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
For development, you connect the entire /project as an external volume and work with it, copy it for production built app into image via COPY to Dockerfile.
docker-compose has nothing to do with building an image, it is for describing the conditions for launching a container or a bunch of containers (plus an interface for managing the docker-compose up type). Just a handy alternative to long docker run commands with lots of options.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question