task/49-docker #8
@@ -9,8 +9,8 @@ services:
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
context: ..
|
||||
dockerfile: SerpentRace_Docker/Dockerfile
|
||||
target: prod
|
||||
environment:
|
||||
POSTGRES_HOST: db
|
||||
@@ -23,10 +23,10 @@ services:
|
||||
command: ["npx", "nodemon", "src/index.mjs"]
|
||||
develop:
|
||||
watch:
|
||||
- path: ./SerpentRace_Backend/src
|
||||
- path: ../SerpentRace_Backend/src
|
||||
action: sync
|
||||
target: /usr/local/app/backend/src
|
||||
- path: ./SerpentRace_Backend/package.json
|
||||
- path: ../SerpentRace_Backend/package.json
|
||||
action: rebuild
|
||||
labels:
|
||||
traefik.http.routers.backend.rule: Host(`localhost`) && PathPrefix(`/api`)
|
||||
@@ -36,17 +36,17 @@ services:
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
context: ..
|
||||
dockerfile: SerpentRace_Docker/Dockerfile
|
||||
target: client-build
|
||||
command: ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "5173"]
|
||||
working_dir: /usr/local/app/frontend
|
||||
develop:
|
||||
watch:
|
||||
- path: ./SerpentRace_Frontend/src
|
||||
- path: ../SerpentRace_Frontend/src
|
||||
action: sync
|
||||
target: /usr/local/app/frontend/src
|
||||
- path: ./SerpentRace_Frontend/package.json
|
||||
- path: ../SerpentRace_Frontend/package.json
|
||||
action: rebuild
|
||||
labels:
|
||||
traefik.http.routers.frontend.rule: Host(`localhost`)
|
||||
@@ -0,0 +1,2 @@
|
||||
docker compose down -v
|
||||
pause
|
||||
@@ -1,22 +0,0 @@
|
||||
### Building and running your application
|
||||
|
||||
When you're ready, start your application by running:
|
||||
`docker compose up --build`.
|
||||
|
||||
Your application will be available at http://localhost:5173.
|
||||
|
||||
### Deploying your application to the cloud
|
||||
|
||||
First, build your image, e.g.: `docker build -t myapp .`.
|
||||
If your cloud uses a different CPU architecture than your development
|
||||
machine (e.g., you are on a Mac M1 and your cloud provider is amd64),
|
||||
you'll want to build the image for that platform, e.g.:
|
||||
`docker build --platform=linux/amd64 -t myapp .`.
|
||||
|
||||
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`.
|
||||
|
||||
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/)
|
||||
docs for more detail on building and pushing.
|
||||
|
||||
### References
|
||||
* [Docker's Node.js guide](https://docs.docker.com/language/nodejs/)
|
||||
@@ -1 +1,3 @@
|
||||
docker compose watch
|
||||
cd ./SerpentRace_Docker
|
||||
docker compose watch
|
||||
pause
|
||||
Reference in New Issue
Block a user