Skip to content

Commit 43ecca7

Browse files
committed
docs: simplify deployment posts (no buildx separate HCL file)
1 parent df9527c commit 43ecca7

File tree

2 files changed

+28
-42
lines changed
  • adminforth/documentation/blog
    • 2025-02-19-compose-ec2-deployment-ci-registry
    • 2025-02-19-compose-ec2-deployment-ecr-ci

2 files changed

+28
-42
lines changed

adminforth/documentation/blog/2025-02-19-compose-ec2-deployment-ci-registry/index.md

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ This command already creates a `Dockerfile` and `.dockerignore` for you, so you
7575
create folder `deploy` and create file `compose.yml` inside:
7676

7777
```yml title="deploy/compose.yml"
78-
79-
8078
services:
8179
traefik:
8280
image: "traefik:v2.5"
@@ -90,15 +88,20 @@ services:
9088
- "/var/run/docker.sock:/var/run/docker.sock:ro"
9189

9290
myadmin:
93-
image: localhost:5000/myadmin:latest
91+
image: ${MYADMIN_REPO}:latest
92+
build:
93+
context: ../adminforth-app
94+
tags:
95+
- ${MYADMIN_REPO}:latest
96+
cache_from:
97+
- type=registry,ref=${MYADMIN_REPO}:cache
98+
cache_to:
99+
- type=registry,ref=${MYADMIN_REPO}:cache,mode=max,compression=zstd,image-manifest=true,oci-mediatypes=true
100+
94101
pull_policy: always
95102
restart: always
96103
env_file:
97104
- .env.secrets.prod
98-
environment:
99-
- NODE_ENV=production
100-
- DATABASE_URL=sqlite://.db.sqlite
101-
- PRISMA_DATABASE_URL=file:.db.sqlite
102105

103106
volumes:
104107
- myadmin-db:/code/db
@@ -148,29 +151,16 @@ tfplan
148151
.env.secrets.prod
149152
```
150153

151-
## Step 6 - buildx bake file
152-
153-
Create file `deploy/docker-bake.hcl`:
154-
155-
```hcl title="deploy/docker-bake.hcl"
156-
variable "REGISTRY_BASE" {
157-
default = "appserver.local:5000"
158-
}
154+
## Step 6 - file with secrets for local deploy
159155

160-
group "default" {
161-
targets = ["myadmin"]
162-
}
156+
Create file `deploy/.env.secrets.prod`
163157

164-
target "myadmin" {
165-
context = "../myadmin"
166-
tags = ["${REGISTRY_BASE}/myadmin:latest"]
167-
cache-from = ["type=registry,ref=${REGISTRY_BASE}/myadmin:cache"]
168-
cache-to = ["type=registry,ref=${REGISTRY_BASE}/myadmin:cache,mode=max,compression=zstd"]
169-
push = true
170-
}
158+
```bash
159+
ADMINFORTH_SECRET=<your_secret>
171160
```
172161

173162

163+
174164
## Step 7 - main terraform file main.tf
175165

176166
First of all install Terraform as described here [terraform installation](https://developer.hashicorp.com/terraform/install#linux).

adminforth/documentation/blog/2025-02-19-compose-ec2-deployment-ecr-ci/index.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ services:
152152

153153
myadmin:
154154
image: ${MYADMIN_REPO}:latest
155+
build:
156+
context: ../adminforth-app
157+
tags:
158+
- ${MYADMIN_REPO}:latest
159+
cache_from:
160+
- type=registry,ref=${MYADMIN_REPO}:cache
161+
cache_to:
162+
- type=registry,ref=${MYADMIN_REPO}:cache,mode=max,compression=zstd,image-manifest=true,oci-mediatypes=true
163+
155164
pull_policy: always
156165
restart: always
157166
env_file:
@@ -205,25 +214,12 @@ tfplan
205214
.env.secrets.prod
206215
```
207216

208-
## Step 6 - buildx bake file
209-
210-
Create file `deploy/docker-bake.hcl`:
217+
## Step 6 - file with secrets for local deploy
211218

212-
```hcl title="deploy/docker-bake.hcl"
213-
variable "MYADMIN_REPO" {
214-
default = ""
215-
}
216-
group "default" {
217-
targets = ["myadmin"]
218-
}
219+
Create file `deploy/.env.secrets.prod`
219220

220-
target "myadmin" {
221-
context = "../myadmin"
222-
tags = ["${MYADMIN_REPO}:latest"]
223-
cache-from = ["type=registry,ref=${MYADMIN_REPO}:cache"]
224-
cache-to = ["type=registry,ref=${MYADMIN_REPO}:cache,mode=max,compression=zstd,image-manifest=true,oci-mediatypes=true"]
225-
push = true
226-
}
221+
```bash
222+
ADMINFORTH_SECRET=<your_secret>
227223
```
228224

229225

0 commit comments

Comments
 (0)