以下是我的 .gitlab-ci.yml
stages:
- build
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
services:
- docker:dind
build-image:
image: docker:stable
stage: build
script:
- docker build --no-cache -t repo/myimage:$CI_JOB_ID .
- docker push repo/myimage:$CI_JOB_ID
Run Code Online (Sandbox Code Playgroud)
我已经在 Gitlab 中设置了 DOCKER_AUTH_CONFIG,如下所示(包含所有匹配的可能性)
{
"auths": {
"https://index.docker.io": {
"auth": "...."
},
"https://index.docker.io/v1/": {
"auth": "..."
},
"https://index.docker.io/v2/": {
"auth": "..."
},
"index.docker.io/v1/": {
"auth": "..."
},
"index.docker.io/v2/": {
"auth": "..."
},
"docker.io/repo/myimage": {
"auth": "..."
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,每当尝试推送图像时,就会出现以下错误
$ docker push repo/myimage:$CI_JOB_ID
The push refers to repository [docker.io/repo/myimage] …Run Code Online (Sandbox Code Playgroud) 这是我想要做的:
还有一个看起来像这样的docker-compose.yml:
task1:
build: ./task1
volumes_from:
- task1_output
command: ./task1.sh
task1_output:
image: alpine:3.3
volumes:
- /root/app/dist
command: /bin/sh
# essentially I want to copy task1 output into task2 because they each use different images and use different tech stacks...
task2:
build: ../task2
volumes_from:
- task2_output
- task1_output:ro
command: /bin/bash -cx "mkdir -p task1 && cp -R /root/app/dist/* ."
Run Code Online (Sandbox Code Playgroud)
所以现在所有必需的文件都在task2容器中...如何启动Web服务器并在task2中公开包含内容的端口?
我被困在这里......如何从combine-tasks/Dockerfile中的task2_output访问这些东西:
combine-both-task2:
build: …Run Code Online (Sandbox Code Playgroud) 根据 JDBI 文档https://jdbi.org/#_jackson_2,似乎拥有对象模型的 json 属性非常简单,但是我尝试了以下方法,但遇到了很多问题。
DB:列类型为 Jsonb 的 Postgres
class Event {
private String name;
@Json
private EventProperty jsonProperty;
...
}
Run Code Online (Sandbox Code Playgroud)
数据源已配置为
@Bean
public Jdbi jdbi(TransactionAwareDataSourceProxy eventStoreTxAwareDataSourceProxy) {
Jdbi jdbi = Jdbi.create(eventStoreTxAwareDataSourceProxy);
jdbi.installPlugin(new PostgresPlugin());
jdbi.installPlugin(new Jackson2Plugin());
}
Run Code Online (Sandbox Code Playgroud)
SQL用于绑定插入列表
INSERT INTO event (name, json_property)
VALUES (
:name,
:jsonProperty)
Run Code Online (Sandbox Code Playgroud)
运行插入代码时,出现以下错误:
org.jdbi.v3.core.statement.UnableToCreateStatementException: no argument factory for type com.EventProperty [statement:"INSERT INTO event (...]
Run Code Online (Sandbox Code Playgroud)
如果我创建了 EventPropertyArgumentFactory 并使用 Jackson ObjectMapper 和 writeValueAsString 那么我可以将其保存到数据库。但是,当从数据库检索它时
try (Handle handle = jdbi.open()) {
EventDao dao = handle.attach(EventDao.class);
return …Run Code Online (Sandbox Code Playgroud) 我见过的大多数示例都使用 entityManager.createQuery 或 .createNativeQuery 等。
有没有办法让类似以下的工作?
data class SummaryDto(val employeeName: String, val employerName: String)
@Query("select e.name as employeeName, emp.name as employerName " +
"from Employer e " +
"inner join Employee emp on emp.employer_id = e.id ", nativeQuery = true)
fun findSummaries(): List<SummaryDto>
Run Code Online (Sandbox Code Playgroud)
当我运行上面的代码时
我收到此错误找不到能够从类型转换的转换器
[org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [dto.SummaryDto]
这可以用 Kotlin 来完成,还是有另一种方法可以让它与基于 Hibernate JPA Annotation 的一起工作?
谢谢锡
docker ×2
dockerfile ×1
gitlab ×1
gitlab-ci ×1
hibernate ×1
jdbi ×1
jdbi3 ×1
jdbi3-core ×1
kotlin ×1