Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fixes

Andras Bacsai0dad616c38e7
diff --git a/apps/api/src/lib/buildPacks/docker.ts b/apps/api/src/lib/buildPacks/docker.ts
index 777dda157f..902dd449b3 100644
--- a/apps/api/src/lib/buildPacks/docker.ts
+++ b/apps/api/src/lib/buildPacks/docker.ts
@@ -20,7 +20,11 @@ export default async function (data) {
.toString()
.trim()
.split('\n');
- Dockerfile.push(`LABEL coolify.buildId=${buildId}`);
+ Dockerfile.forEach((line, index) => {
+ if (line.startsWith('FROM')) {
+ Dockerfile.splice(index + 1, 0, `LABEL coolify.buildId=${buildId}`);
+ }
+ });
if (secrets.length > 0) {
secrets.forEach((secret) => {
if (secret.isBuildSecret) {
@@ -28,11 +32,9 @@ export default async function (data) {
(pullmergeRequestId && secret.isPRMRSecret) ||
(!pullmergeRequestId && !secret.isPRMRSecret)
) {
- Dockerfile.unshift(`ARG ${secret.name}=${secret.value}`);
-
Dockerfile.forEach((line, index) => {
if (line.startsWith('FROM')) {
- Dockerfile.splice(index + 1, 0, `ARG ${secret.name}`);
+ Dockerfile.splice(index + 1, 0, `ARG ${secret.name}=${secret.value}`);
}
});
}
diff --git a/apps/api/src/routes/api/v1/applications/handlers.ts b/apps/api/src/routes/api/v1/applications/handlers.ts
index 82a8613aba..f43a5c536a 100644
--- a/apps/api/src/routes/api/v1/applications/handlers.ts
+++ b/apps/api/src/routes/api/v1/applications/handlers.ts
@@ -843,18 +843,11 @@ export async function saveApplicationSource(request: FastifyRequest<SaveApplicat
const { id } = request.params
const { gitSourceId, forPublic, type, simpleDockerfile } = request.body
if (forPublic) {
- if (gitSourceId) {
- await prisma.application.update({
- where: { id },
- data: { gitSource: { connect: { id: gitSourceId } } }
- });
- } else {
- const publicGit = await prisma.gitSource.findFirst({ where: { type, forPublic } });
- await prisma.application.update({
- where: { id },
- data: { gitSource: { connect: { id: publicGit.id } } }
- });
- }
+ const publicGit = await prisma.gitSource.findFirst({ where: { type, forPublic } });
+ await prisma.application.update({
+ where: { id },
+ data: { gitSource: { connect: { id: publicGit.id } } }
+ });
}
if (simpleDockerfile) {
await prisma.application.update({
@@ -862,6 +855,12 @@ export async function saveApplicationSource(request: FastifyRequest<SaveApplicat
data: { simpleDockerfile, settings: { update: { autodeploy: false } } }
});
}
+ if (gitSourceId) {
+ await prisma.application.update({
+ where: { id },
+ data: { gitSource: { connect: { id: gitSourceId } } }
+ });
+ }
return reply.code(201).send()