If you can already run your app in Docker, you wont gain much from Docker Compose, unless you need to run multiple containers. As stated in Overview of Docker Compose, Compose is a tool for defining and running multi-container Docker applications.
Based on the linked tutorial,
docker-compose.yaml could look something like this:
version: 3 services: nuxt: image: nuxtjs-tutorial:latest ports: - 3000:3000 environment: - NUXT_HOST=0.0.0.0 - NUXT_PORT=3000
The environment variables do not need to be set from the Compose file, this is just an example. Compose allows you to set many options, as described in the Compose file reference. For example, you could run the app in Compose using
entrypoint instead of
Dockerfile. Or you could only copy
Dockerfile, build the dependencies during image build, and mount your code using
I found multiple example references online, but I woulnt consider any of them best practice. Best to read the official Documentation.
Regarding your update, based on the
Dockerfile in the tutorial, you do not even need the
command entries, only
ports. But as I said above, you can set many options from Compose, best described in official documentation.