Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions perry/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ RUN curl -fsSL https://claude.ai/install.sh | bash

RUN curl -fsSL https://opencode.ai/install | bash

RUN bunx playwright install chromium --with-deps

USER root

ENV PATH="/home/workspace/.opencode/bin:${PATH}"
Expand Down
25 changes: 23 additions & 2 deletions src/workspace/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,22 @@ export class WorkspaceManager {
containerEnv.WORKSPACE_REPO_URL = clone;
}

const dockerVolumeName = `${VOLUME_PREFIX}${name}-docker`;
if (!(await docker.volumeExists(dockerVolumeName))) {
await docker.createVolume(dockerVolumeName);
}

const containerId = await docker.createContainer({
name: containerName,
image: workspaceImage,
hostname: name,
privileged: true,
restartPolicy: 'unless-stopped',
env: containerEnv,
volumes: [{ source: volumeName, target: '/home/workspace', readonly: false }],
volumes: [
{ source: volumeName, target: '/home/workspace', readonly: false },
{ source: dockerVolumeName, target: '/var/lib/docker', readonly: false },
],
ports: [{ hostPort: sshPort, containerPort: 22, protocol: 'tcp' }],
labels: {
'workspace.name': name,
Expand Down Expand Up @@ -620,14 +628,22 @@ export class WorkspaceManager {
containerEnv.WORKSPACE_REPO_URL = workspace.repo;
}

const dockerVolumeName = `${VOLUME_PREFIX}${name}-docker`;
if (!(await docker.volumeExists(dockerVolumeName))) {
await docker.createVolume(dockerVolumeName);
}

const containerId = await docker.createContainer({
name: containerName,
image: workspaceImage,
hostname: name,
privileged: true,
restartPolicy: 'unless-stopped',
env: containerEnv,
volumes: [{ source: volumeName, target: '/home/workspace', readonly: false }],
volumes: [
{ source: volumeName, target: '/home/workspace', readonly: false },
{ source: dockerVolumeName, target: '/var/lib/docker', readonly: false },
],
ports: [{ hostPort: sshPort, containerPort: 22, protocol: 'tcp' }],
labels: {
'workspace.name': name,
Expand Down Expand Up @@ -695,6 +711,7 @@ export class WorkspaceManager {

const containerName = getContainerName(name);
const volumeName = `${VOLUME_PREFIX}${name}`;
const dockerVolumeName = `${VOLUME_PREFIX}${name}-docker`;

if (await docker.containerExists(containerName)) {
await docker.removeContainer(containerName, true);
Expand All @@ -704,6 +721,10 @@ export class WorkspaceManager {
await docker.removeVolume(volumeName, true);
}

if (await docker.volumeExists(dockerVolumeName)) {
await docker.removeVolume(dockerVolumeName, true);
}

await this.state.deleteWorkspace(name);
}

Expand Down