Skip to content

Commit 371f131

Browse files
committed
Fix local development
1 parent 2e86de8 commit 371f131

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

templates/cli/lib/emulation/docker.js.twig

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ async function dockerBuild(func, variables) {
5151

5252
const id = func.$id;
5353

54+
const files = getAllFiles(functionDir).map((file) => path.relative(functionDir, file)).filter((file) => !ignorer.ignores(file));
55+
const tmpBuildPath = path.join(functionDir, '.appwrite/tmp-build');
56+
if (!fs.existsSync(tmpBuildPath)) {
57+
fs.mkdirSync(tmpBuildPath, { recursive: true });
58+
}
59+
60+
for(const f of files) {
61+
const filePath = path.join(tmpBuildPath, f);
62+
const fileDir = path.dirname(filePath);
63+
if (!fs.existsSync(fileDir)) {
64+
fs.mkdirSync(fileDir, { recursive: true });
65+
}
66+
67+
const sourcePath = path.join(functionDir, f);
68+
fs.copyFileSync(sourcePath, filePath);
69+
}
70+
5471
const params = [ 'run' ];
5572
params.push('--name', id);
5673
params.push('-v', `${tmpBuildPath}/:/mnt/code:rw`);
@@ -139,23 +156,6 @@ async function dockerStart(func, variables, port) {
139156
ignorer.add(fs.readFileSync(path.join(functionDir, '.gitignore')).toString());
140157
}
141158

142-
const files = getAllFiles(functionDir).map((file) => path.relative(functionDir, file)).filter((file) => !ignorer.ignores(file));
143-
const tmpBuildPath = path.join(functionDir, '.appwrite/tmp-build');
144-
if (!fs.existsSync(tmpBuildPath)) {
145-
fs.mkdirSync(tmpBuildPath, { recursive: true });
146-
}
147-
148-
for(const f of files) {
149-
const filePath = path.join(tmpBuildPath, f);
150-
const fileDir = path.dirname(filePath);
151-
if (!fs.existsSync(fileDir)) {
152-
fs.mkdirSync(fileDir, { recursive: true });
153-
}
154-
155-
const sourcePath = path.join(functionDir, f);
156-
fs.copyFileSync(sourcePath, filePath);
157-
}
158-
159159
const runtimeChunks = func.runtime.split("-");
160160
const runtimeVersion = runtimeChunks.pop();
161161
const runtimeName = runtimeChunks.join("-");

0 commit comments

Comments
 (0)