(compose: Compose)
| 4 | import { encodeBase64 } from "../docker/utils"; |
| 5 | |
| 6 | export const getCreateComposeFileCommand = (compose: Compose) => { |
| 7 | const { COMPOSE_PATH } = paths(!!compose.serverId); |
| 8 | const { appName, composeFile } = compose; |
| 9 | const outputPath = join(COMPOSE_PATH, appName, "code"); |
| 10 | const filePath = join(outputPath, "docker-compose.yml"); |
| 11 | const encodedContent = encodeBase64(composeFile); |
| 12 | const bashCommand = ` |
| 13 | rm -rf ${outputPath}; |
| 14 | mkdir -p ${outputPath}; |
| 15 | echo "${encodedContent}" | base64 -d > "${filePath}"; |
| 16 | echo "File 'docker-compose.yml' created: ✅"; |
| 17 | `; |
| 18 | return bashCommand; |
| 19 | }; |
no test coverage detected