File tree Expand file tree Collapse file tree 3 files changed +37
-3
lines changed
deploy/helm/auth/templates Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 14
14
spec :
15
15
imagePullSecrets :
16
16
- name : j11er-docker-registry
17
+ initContainers :
18
+ - name : migrations
19
+ image : {{ .Values.app.image.tag }}
20
+ imagePullPolicy : IfNotPresent
21
+ envFrom :
22
+ - configMapRef :
23
+ name : auth-backend-env-config
24
+ command : ["/bin/sh"]
25
+ args : ["/opt/service/auth/run-migrations.sh"]
26
+ volumeMounts :
27
+ - name : bash-script-clickhouse
28
+ mountPath : /opt/service/auth/
29
+ subPath : run-migrations.sh
17
30
containers :
18
31
- name : auth-backend
19
32
image : {{ .Values.app.image.tag }}
32
45
requests :
33
46
cpu : 100m
34
47
memory : 256Mi
48
+ volumes :
49
+ - name : bash-script-migrations
50
+ configMap :
51
+ name : bash-script-migrations
Original file line number Diff line number Diff line change
1
+ kind : ConfigMap
2
+ apiVersion : v1
3
+ metadata :
4
+ name : bash-script-migrations
5
+ data :
6
+ run-migrations.sh : |-
7
+ #!/bin/sh
8
+
9
+ printenv
10
+ echo $(ls)
11
+ apk --no-cache add curl
12
+ curl -fsSL https://raw.githubusercontent.com/pressly/goose/master/install.sh | GOOSE_INSTALL=$HOME/.goose sh -s v3.20.0
13
+
14
+ set GOOSE_DBSTRING=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?sslmode=disable
15
+ goose -dir migrations/postgres postgres up
Original file line number Diff line number Diff line change
1
+ # builder stage
1
2
FROM golang:1.22.4-alpine as builder
2
3
3
- ENV CGO_ENABLED=0 \
4
- GOOS=linux \
5
- GOARCH=amd64
4
+ ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
6
5
7
6
WORKDIR /opt
8
7
@@ -15,9 +14,12 @@ RUN go mod download
15
14
RUN go build -o app/main service/auth/cmd/app/main.go
16
15
17
16
17
+ # runtime stage
18
18
FROM scratch as runtime
19
19
20
20
WORKDIR /opt/service/auth
21
21
22
22
COPY --from=builder /opt/app/main /main
23
+ COPY --from=builder /opt/service/auth/migrations /migrations
24
+
23
25
ENTRYPOINT ["/main" ]
You can’t perform that action at this time.
0 commit comments