我试图理解为什么有时我.php
在我的项目中更新 a 它每次都会完全重建图像,而其他时候它似乎没有做任何事情。实际上关于后者,它说Syncing 1 files for ...
,但我的任何更改都没有反映出来。
这是我的项目结构:
/app
/admin
/conf
app.conf
/src
/lib
lib.php
index.php
Dockerfile.dev
/manifests
/dev
ingress.yaml
admin.yaml
skaffold.yaml
./admin/conf/app.conf
当我对or进行更改时./admin/src/index.php
,我只得到Syncing 1 files for...
,但没有任何更改反映在应用程序中。我必须CTRL+C
杀死 Skaffold 并重新启动它......只是CTRL+S
在一个.yaml
或lib.php
触发重建。
当我对 进行更改时./admin/src/lib/lib.php
,它会从头开始重建整个图像。
这是我的配置:
# skaffold.yaml
apiVersion: skaffold/v1beta15
kind: Config
build:
local:
push: false
artifacts:
- image: postgres
context: postgres
docker:
dockerfile: Dockerfile.dev
sync:
manual:
- src: "***/*.sql"
dest: .
- image: testappacr.azurecr.io/test-app-admin
context: admin
docker:
dockerfile: Dockerfile.dev
sync:
manual:
- src: "***/*.php"
dest: .
- src: "***/*.conf"
dest: .
- src: "***/*.tbs"
dest: .
- src: "***/*.css"
dest: .
- src: "***/*.js"
dest: .
deploy:
kubectl:
manifests:
- manifests/dev/ingress.yaml
- manifests/dev/postgres.yaml
- manifests/dev/admin.yaml
# Dockerfile.dev
FROM php:7.3-fpm
EXPOSE 4000
COPY . /app
WORKDIR /app/src
RUN apt-get update \
&& apt-get install -y libpq-dev zlib1g-dev libzip-dev \
&& docker-php-ext-install pgsql zip
CMD ["php", "-S", "0.0.0.0:4000"]
apiVersion: apps/v1
kind: Deployment
metadata:
name: admin-deployment-dev
spec:
replicas: 1
selector:
matchLabels:
component: admin
template:
metadata:
labels:
component: admin
spec:
containers:
- name: admin
image: testappacr.azurecr.io/test-app-admin
ports:
- containerPort: 4000
env:
- name: PGUSER
valueFrom:
secretKeyRef:
name: test-app-dev-secrets
key: PGUSER
- name: PGHOST
value: postgres-cluster-ip-service-dev
- name: PGPORT
value: "1423"
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: test-app-dev-secrets
key: PGDATABASE
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: test-app-dev-secrets
key: PGPASSWORD
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: test-app-dev-secrets
key: SECRET_KEY
- name: SENDGRID_API_KEY
valueFrom:
secretKeyRef:
name: test-app-dev-secrets
key: SENDGRID_API_KEY
- name: DOMAIN
valueFrom:
secretKeyRef:
name: test-app-dev-secrets
key: DOMAIN
- name: DEBUG
valueFrom:
secretKeyRef:
name: test-app-dev-secrets
key: DEBUG
# livenessProbe:
# tcpSocket:
# port: 4000
# initialDelaySeconds: 2
# periodSeconds: 2
# readinessProbe:
# tcpSocket:
# port: 4000
# initialDelaySeconds: 2
# periodSeconds: 2
volumeMounts:
- mountPath: "/docs/"
name: file-storage
volumes:
- name: file-storage
persistentVolumeClaim:
claimName: file-storage
---
apiVersion: v1
kind: Service
metadata:
name: admin-cluster-ip-service-dev
spec:
type: ClusterIP
selector:
component: admin
ports:
- port: 4000
targetPort: 4000
我想我试图理解一些事情:
- 为什么在一种情况下会触发完整的重建?
- 为什么文件被“同步”,但在我触发重建之前更改不会反映?
- 如何在不触发完全重建的情况下让我的更改反映在应用程序中?
谢谢!