我是个新手,所以请耐心等待。我熟悉编写本地应用程序和脚本来自动执行我需要执行的管理任务,但现在我正在尝试熟悉 Gitlab CI/CD 流程。我一直在使用(并且喜欢)VSCode devcontainers,因为我陷入了学习 Python 虚拟环境并尝试管理不同 python 版本等的困境,而 devcontainers 让我所有的头痛都消失了。现在我试图弄清楚如何编写一个简单的应用程序(如 Flask 端点)并通过 Gitlab CI/CD 进行部署。
我目前陷入了如何将 devcontainer 的 VSCode Dockerfile 转换为生产就绪的 Dockerfile 的困境。例如,VSCode Dockerfile 使用了一个我认为在生产环境中无法接受的 VSCode 基础镜像。是否有为部署创建生产 Docker 配置的最佳实践?如果只是简单地创建一个单独的 Dockerfile,这是否违背了使用 Docker 容器进行开发的目的之一?您仍然会遇到“它在我的容器中工作正常......”的情况
我正在尝试弄清楚如何使用Firebase向Android发送推送通知,并使用旧版HTTP(https://fcm.googleapis.com/fcm/send)进行工作,但文档建议使用较新的端点(https: //fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send).我似乎无法让它工作,因为我一直得到这样的回应:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
Run Code Online (Sandbox Code Playgroud)
使用https://firebase.google.com/docs/cloud-messaging/send-message#send_messages_to_specific_devices上的示例进行此操作:
POST https://fcm.googleapis.com/v1/projects/project-916177026973/messages:send HTTP/1.1
cache-control: no-cache
Postman-Token: 81403929-77ba-4568-8681-a854527ccb22
Content-Type: application/json
Authorization: Bearer <token redacted>
User-Agent: PostmanRuntime/6.4.1
Accept: */*
Host: fcm.googleapis.com
accept-encoding: gzip, deflate
content-length: 319
Connection: close
{
"message":{
"token" : <token redacted>,
"notification" : {
"body" : "This is an FCM notification message!",
"title" : "FCM Message",
}
}
}
Run Code Online (Sandbox Code Playgroud)
我还尝试删除最后一个逗号以使其符合JSON并仍然没有运气.有任何想法吗?