File tree Expand file tree Collapse file tree 2 files changed +22
-56
lines changed Expand file tree Collapse file tree 2 files changed +22
-56
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,13 @@ jobs:
12
12
- name : Checkout repository
13
13
uses : actions/checkout@v4
14
14
15
- - name : Create env file in /server
16
- run : |
17
- mkdir -p server
18
- touch server/.env
19
- echo DATABASE_URI=${{ vars.DATABASE_URI }} >> server/.env
20
- cat server/.env # Verify the file is created
21
-
22
15
- name : Build Docker image
23
- run : docker build -t my-app:latest -t my-app:${{ github.sha }} -f server/Dockerfile server
16
+ run : docker build -t nettleship-net-api:latest -f server/Dockerfile server
17
+
18
+ - name : Deploy to Docker Swarm
19
+ run : |
20
+ # Make sure Docker is available and the image is built
21
+ docker pull nettleship-net-api:latest # (if needed, to ensure the latest is on the Pi)
22
+
23
+ # Deploy to Swarm
24
+ docker stack deploy -c docker-compose.yml nettleship-net-api
Original file line number Diff line number Diff line change 1
- # Comments are provided throughout this file to help you get started.
2
- # If you need more help, visit the Docker Compose reference guide at
3
- # https://docs.docker.com/go/compose-spec-reference/
1
+ version : " 3.9"
4
2
5
- # Here the instructions define your application as a service called "server".
6
- # This service is built from the Dockerfile in the current directory.
7
- # You can add other services your application may depend on here, such as a
8
- # database or a cache. For examples, see the Awesome Compose repository:
9
- # https://github.com/docker/awesome-compose
10
3
services :
11
- server :
12
- build :
13
- context : .
14
- environment :
15
- NODE_ENV : production
4
+ nettleship-net-api :
5
+ image : nettleship-net-api:latest
6
+ deploy :
7
+ replicas : 1
8
+ restart_policy :
9
+ condition : none
10
+ placement :
11
+ constraints :
12
+ - node.role == manager # This ensures the service runs only on the manager node (pi-1)
16
13
ports :
17
- - 8000:8000
18
-
19
- # The commented out section below is an example of how to define a PostgreSQL
20
- # database that your application can use. `depends_on` tells Docker Compose to
21
- # start the database before your application. The `db-data` volume persists the
22
- # database data between container restarts. The `db-password` secret is used
23
- # to set the database password. You must create `db/password.txt` and add
24
- # a password of your choosing to it before running `docker-compose up`.
25
- # depends_on:
26
- # db:
27
- # condition: service_healthy
28
- # db:
29
- # image: postgres
30
- # restart: always
31
- # user: postgres
32
- # secrets:
33
- # - db-password
34
- # volumes:
35
- # - db-data:/var/lib/postgresql/data
36
- # environment:
37
- # - POSTGRES_DB=example
38
- # - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
39
- # expose:
40
- # - 5432
41
- # healthcheck:
42
- # test: [ "CMD", "pg_isready" ]
43
- # interval: 10s
44
- # timeout: 5s
45
- # retries: 5
46
- # volumes:
47
- # db-data:
48
- # secrets:
49
- # db-password:
50
- # file: db/password.txt
51
-
14
+ - " 3000:3000"
15
+ volumes :
16
+ - ./logs:/usr/src/app/logs
You can’t perform that action at this time.
0 commit comments