fix: template files

This commit is contained in:
Andras Bacsai 2022-11-07 10:44:50 +01:00
parent 2a9bd00a50
commit 85030ab804
3 changed files with 14 additions and 18 deletions

View File

@ -1312,8 +1312,7 @@
- SETUID - SETUID
- DAC_OVERRIDE - DAC_OVERRIDE
files: files:
- source: $$workdir/settings.yml - location: /etc/searxng/settings.yml
destination: /etc/searxng/settings.yml
content: |2- content: |2-
# see https://docs.searxng.org/admin/engines/settings.html#use-default-settings # see https://docs.searxng.org/admin/engines/settings.html#use-default-settings
@ -1685,8 +1684,7 @@
- POSTGRES_DB=$$config_postgres_db - POSTGRES_DB=$$config_postgres_db
ports: [] ports: []
files: files:
- source: $$workdir/schema.postgresql.sql - location: /docker-entrypoint-initdb.d/schema.postgresql.sql
destination: /docker-entrypoint-initdb.d/schema.postgresql.sql
content: |2- content: |2-
-- CreateTable -- CreateTable
@ -2615,8 +2613,7 @@
soft: 262144 soft: 262144
hard: 262144 hard: 262144
files: files:
- source: $$workdir/clickhouse-config.xml - location: /etc/clickhouse-server/users.d/logging.xml
destination: /etc/clickhouse-server/users.d/logging.xml
content: >- content: >-
<yandex><logger><level>warning</level><console>true</console></logger><query_thread_log <yandex><logger><level>warning</level><console>true</console></logger><query_thread_log
remove="remove"/><query_log remove="remove"/><text_log remove="remove"/><query_log remove="remove"/><text_log
@ -2624,15 +2621,12 @@
remove="remove"/><asynchronous_metric_log remove="remove"/><asynchronous_metric_log
remove="remove"/><session_log remove="remove"/><part_log remove="remove"/><session_log remove="remove"/><part_log
remove="remove"/></yandex> remove="remove"/></yandex>
- source: $$workdir/clickhouse-user-config.xml - location: /etc/clickhouse-server/config.d/logging.xml
destination: /etc/clickhouse-server/config.d/logging.xml
content: >- content: >-
<yandex><profiles><default><log_queries>0</log_queries><log_query_threads>0</log_query_threads></default></profiles></yandex> <yandex><profiles><default><log_queries>0</log_queries><log_query_threads>0</log_query_threads></default></profiles></yandex>
- source: $$workdir/init.query - location: /docker-entrypoint-initdb.d/init.query
destination: /docker-entrypoint-initdb.d/init.query
content: CREATE DATABASE IF NOT EXISTS plausible; content: CREATE DATABASE IF NOT EXISTS plausible;
- source: $$workdir/init-db.sh - location: /docker-entrypoint-initdb.d/init-db.sh
destination: /docker-entrypoint-initdb.d/init-db.sh
content: >- content: >-
clickhouse client --queries-file clickhouse client --queries-file
/docker-entrypoint-initdb.d/init.query /docker-entrypoint-initdb.d/init.query

View File

@ -108,8 +108,8 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
// Generate files for builds // Generate files for builds
if (template.services[s]?.files?.length > 0) { if (template.services[s]?.files?.length > 0) {
if (!template.services[s].build) { if (!config[s].build) {
template.services[s].build = { config[s].build = {
context: workdir, context: workdir,
dockerfile: `Dockerfile.${s}` dockerfile: `Dockerfile.${s}`
} }
@ -117,12 +117,14 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
let Dockerfile = ` let Dockerfile = `
FROM ${template.services[s].image}` FROM ${template.services[s].image}`
for (const file of template.services[s].files) { for (const file of template.services[s].files) {
const { source, destination, content } = file; const { location, content } = file;
const source = path.join(workdir, location);
await fs.mkdir(path.dirname(source), { recursive: true });
await fs.writeFile(source, content); await fs.writeFile(source, content);
Dockerfile += ` Dockerfile += `
COPY ./${path.basename(source)} ${destination}` COPY .${location} ${location}`
} }
await fs.writeFile(`${workdir}/Dockerfile.${service}`, Dockerfile); await fs.writeFile(`${workdir}/Dockerfile.${s}`, Dockerfile);
} }
} }
const { volumeMounts } = persistentVolumes(id, persistentStorage, config) const { volumeMounts } = persistentVolumes(id, persistentStorage, config)

File diff suppressed because one or more lines are too long