Add moew docker tags

This commit is contained in:
2024-09-08 23:15:40 +10:00
parent 0a01f4a51d
commit f5efbf3786
4 changed files with 39 additions and 15 deletions
+6 -3
View File
@@ -38,8 +38,11 @@ jobs:
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: |-
${{ steps.meta.outputs.tags }}
ghcr.io/wahyd4/links:1.0.${{ github.run_number }}
labels: |-
${{ steps.meta.outputs.labels }}
- name: Deploy to Kubernetes
uses: wahyd4/kubectl-helm-action@master
@@ -48,6 +51,6 @@ jobs:
with:
args: |-
# Update the deployment.yaml with the new image tag
sed -i 's|image: .*|image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}|' k8s/deployment.yaml
sed -i 's|image: .*|image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:1.0.${{ github.run_number }}|' k8s/deployment.yaml
# Apply Kubernetes manifests
kubectl apply -n apps -f k8s/deployment.yaml
+19 -5
View File
@@ -1,3 +1,15 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: links-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: nfs-client
resources:
requests:
storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -17,17 +29,19 @@ spec:
tags.datadoghq.com/env: "prod"
tags.datadoghq.com/service: "links"
spec:
initContainers:
- name: run-migrations
image: "ghcr.io/wahyd4/links:main"
command: ['python', 'manage.py', 'migrate']
volumes:
- name: data
persistentVolumeClaim:
claimName: links-pvc
containers:
- name: links
image: "ghcr.io/wahyd4/links:main"
securityContext:
runAsUser: 1000
imagePullPolicy: Always
volumeMounts:
- name: data
mountPath: /app/data
env:
- name: DB_HOST
value: new-postgres-postgresql.db.svc.cluster.local
+11
View File
@@ -0,0 +1,11 @@
module.exports = {
content: [
'../templates/**/*.html',
'../../templates/**/*.html',
'../../**/templates/**/*.html',
],
theme: {
extend: {},
},
plugins: [],
}
+3 -7
View File
@@ -22,7 +22,6 @@ ROOT_URLCONF = 'url_manager.urls'
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware', # Add this line
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware', # Make sure this is here
'django.middleware.common.CommonMiddleware',
@@ -66,12 +65,12 @@ DATABASES = {
# 静态文件设置
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
STATIC_ROOT = BASE_DIR / 'static'
STATICFILES_DIRS = [
BASE_DIR / "static",
BASE_DIR / "theme" / "static",
BASE_DIR / "static_src",
]
# 默认自动字段类型
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
@@ -103,6 +102,3 @@ TAILWIND_APP_NAME = 'new_theme'
INTERNAL_IPS = [
"127.0.0.1",
]
# Add this at the end of the file
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'