Skip to content

Commit eacf8f3

Browse files
committed
New bakefile
1 parent ed43106 commit eacf8f3

File tree

2 files changed

+163
-15
lines changed

2 files changed

+163
-15
lines changed

.github/workflows/build.yaml

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,21 @@ jobs:
3131
run:
3232
./gen-rel-notes.sh > CHANGELOG
3333

34-
# - name: Cache Docker layers
35-
# uses: actions/cache@v4
36-
# with:
37-
# path: /tmp/.buildx-cache-app
38-
# key: ${{ runner.os }}-buildx-app-${{ github.sha }}
39-
# restore-keys: |
40-
# ${{ runner.os }}-buildx-app
41-
42-
- name: Build and push
34+
- name: Cache Docker layers
35+
uses: actions/cache@v4
36+
with:
37+
path: /tmp/.buildx-cache-app
38+
key: ${{ runner.os }}-buildx-app-${{ github.sha }}
39+
restore-keys: |
40+
${{ runner.os }}-buildx-app
41+
42+
- name: Prepare for buildx
4343
run: |
4444
cp tdei_uw.env .env
4545
echo "CODE_VERSION=${CODE_VERSION}" >> .env
46-
docker buildx bake -f docker-compose.build.yml --push #--set '*.cache-from=type=local,src=/tmp/.buildx-cache-app' --set '*.cache-to=type=local,dest=/tmp/.buildx-cache-app-new,mode=max' --allow=fs=/tmp
46+
47+
- name: Build and push
48+
uses: docker/[email protected]
4749
env:
4850
ENV: ${{ vars.ENV }}
4951
WS_DOCKER_REGISTRY: ${{ vars.WS_DOCKER_REGISTRY }}
@@ -56,12 +58,36 @@ jobs:
5658
WS_SMTP_PASS: ${{ secrets.WS_SMTP_PASS }}
5759
WS_TASKS_DB_PASS: ${{ secrets.WS_TASKS_DB_PASS }}
5860
WS_TASKS_SECRET_KEY: ${{ secrets.WS_TASKS_SECRET_KEY }}
61+
with:
62+
files: docker-buildx.build.hcl
63+
push: true
64+
set: |
65+
*.cache-from=type=local,src=/tmp/.buildx-cache
66+
*.cache-to=type=local,mode=max,dest=/tmp/.buildx-cache-new
67+
68+
#- name: Build and push
69+
# run: |
70+
# cp tdei_uw.env .env
71+
# echo "CODE_VERSION=${CODE_VERSION}" >> .env
72+
# docker buildx bake -f docker-compose.build.yml --push #--set '*.cache-from=type=local,src=/tmp/.buildx-cache-app' --set #'*.cache-to=type=local,dest=/tmp/.buildx-cache-app-new,mode=max' --allow=fs=/tmp
73+
# env:
74+
# ENV: ${{ vars.ENV }}
75+
# WS_DOCKER_REGISTRY: ${{ vars.WS_DOCKER_REGISTRY }}
76+
#
77+
# # passwords
78+
# WS_API_DB_PASS: ${{ secrets.WS_API_DB_PASS }}
79+
# WS_MAPBOX_ACCESS_TOKEN: ${{ secrets.WS_MAPBOX_ACCESS_TOKEN }}
80+
# WS_OSM_DB_PASS: ${{ secrets.WS_OSM_DB_PASS }}
81+
# WS_OSM_SECRET_KEY_BASE: ${{ secrets.WS_OSM_SECRET_KEY_BASE }}
82+
# WS_SMTP_PASS: ${{ secrets.WS_SMTP_PASS }}
83+
# WS_TASKS_DB_PASS: ${{ secrets.WS_TASKS_DB_PASS }}
84+
# WS_TASKS_SECRET_KEY: ${{ secrets.WS_TASKS_SECRET_KEY }}
5985

60-
# - name: Move cache
61-
# run: |
62-
# rm -rf /tmp/.buildx-cache-app # Remove the old cache.
63-
# mv /tmp/.buildx-cache-app-new /tmp/.buildx-cache-app # Move the new cache to replace the old cache.
64-
86+
- name: Prepare cache
87+
run: |
88+
rm -rf /tmp/.buildx-cache-app # Remove the old cache.
89+
mv /tmp/.buildx-cache-app-new /tmp/.buildx-cache-app # Move the new cache to replace the old cache.
90+
6591
- name: Deploy
6692
env:
6793
ENV: ${{ vars.ENV }}

docker-buildx.build.hcl

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
group "default" {
2+
targets = [
3+
"osm-web",
4+
"pathways-editor",
5+
"rapid",
6+
"osm-cgimap",
7+
"frontend",
8+
"tasks-frontend",
9+
"tasks-backend",
10+
"osm-log-proxy",
11+
"osm-rails"
12+
]
13+
}
14+
15+
variable "WS_DOCKER_REGISTRY" {
16+
default = "opensidewalksdev.azurecr.io"
17+
}
18+
19+
variable "ENV" {
20+
default = "dev"
21+
}
22+
23+
variable "CODE_VERSION" {
24+
default = "0"
25+
}
26+
27+
target "frontend" {
28+
context = "frontend"
29+
dockerfile = "Dockerfile"
30+
args = {
31+
CODE_VERSION = ""
32+
VITE_API_URL = "https://api.workspaces-${ENV}.sidewalks.washington.edu/api/v1/"
33+
VITE_OSM_URL = "https://osm.workspaces-${ENV}.sidewalks.washington.edu/"
34+
VITE_PATHWAYS_EDITOR_URL = "https://pathways.workspaces-${ENV}.sidewalks.washington.edu/"
35+
VITE_RAPID_URL = "https://rapid.workspaces-${ENV}.sidewalks.washington.edu/"
36+
VITE_TDEI_API_URL = "https://tdei-api-${ENV}.azurewebsites.net/api/v1/"
37+
VITE_TDEI_USER_API_URL = "https://tdei-usermanagement-be-${ENV}.azurewebsites.net/api/v1/"
38+
}
39+
tags = [
40+
"${WS_DOCKER_REGISTRY}/workspaces-frontend:${ENV}",
41+
"${WS_DOCKER_REGISTRY}/workspaces-frontend:${CODE_VERSION}"
42+
]
43+
}
44+
45+
target "osm-cgimap" {
46+
context = "osm-cgimap"
47+
dockerfile = "docker/ubuntu/Dockerfile2404"
48+
tags = [
49+
"${WS_DOCKER_REGISTRY}/workspaces-osm-cgimap:${ENV}",
50+
"${WS_DOCKER_REGISTRY}/workspaces-osm-cgimap:${CODE_VERSION}"
51+
]
52+
}
53+
54+
target "osm-log-proxy" {
55+
context = "osm-log-proxy"
56+
dockerfile = "Dockerfile"
57+
tags = [
58+
"${WS_DOCKER_REGISTRY}/workspaces-osm-log-proxy:${ENV}",
59+
"${WS_DOCKER_REGISTRY}/workspaces-osm-log-proxy:${CODE_VERSION}"
60+
]
61+
}
62+
63+
target "osm-rails" {
64+
context = "osm-rails"
65+
dockerfile = "Dockerfile.prod"
66+
tags = [
67+
"${WS_DOCKER_REGISTRY}/workspaces-osm-rails:${ENV}",
68+
"${WS_DOCKER_REGISTRY}/workspaces-osm-rails:${CODE_VERSION}"
69+
]
70+
}
71+
72+
target "osm-web" {
73+
context = "osm-web"
74+
dockerfile = "Dockerfile"
75+
tags = [
76+
"${WS_DOCKER_REGISTRY}/workspaces-osm-web:${ENV}",
77+
"${WS_DOCKER_REGISTRY}/workspaces-osm-web:${CODE_VERSION}"
78+
]
79+
}
80+
81+
target "pathways-editor" {
82+
context = "pathways-editor"
83+
dockerfile = "Dockerfile"
84+
tags = [
85+
"${WS_DOCKER_REGISTRY}/workspaces-pathways-editor:${ENV}",
86+
"${WS_DOCKER_REGISTRY}/workspaces-pathways-editor:${CODE_VERSION}"
87+
]
88+
}
89+
90+
target "rapid" {
91+
context = "rapid"
92+
dockerfile = "Dockerfile"
93+
tags = [
94+
"${WS_DOCKER_REGISTRY}/workspaces-rapid:${ENV}",
95+
"${WS_DOCKER_REGISTRY}/workspaces-rapid:${CODE_VERSION}"
96+
]
97+
}
98+
99+
target "tasks-backend" {
100+
context = "tasking-manager"
101+
dockerfile = "./scripts/docker/Dockerfile.backend"
102+
tags = [
103+
"${WS_DOCKER_REGISTRY}/workspaces-tasks-backend:${ENV}",
104+
"${WS_DOCKER_REGISTRY}/workspaces-tasks-backend:${CODE_VERSION}"
105+
]
106+
target = "prod"
107+
args = {
108+
APP_UID = "1000"
109+
}
110+
}
111+
112+
target "tasks-frontend" {
113+
context = "tasking-manager"
114+
dockerfile = "./scripts/docker/Dockerfile.frontend"
115+
tags = [
116+
"${WS_DOCKER_REGISTRY}/workspaces-tasks-frontend:${ENV}",
117+
"${WS_DOCKER_REGISTRY}/workspaces-tasks-frontend:${CODE_VERSION}"
118+
]
119+
args = {
120+
TM_APP_API_URL = "https://tasks.workspaces-${ENV}.sidewalks.washington.edu/"
121+
}
122+
}

0 commit comments

Comments
 (0)