Deploying from a Local Directory
You can deploy a local directory on Hostim.dev. The CLI packs the directory into a .tar.gz, uploads it, and Hostim builds it with the Dockerfile. No git remote and no Docker image are needed.
To deploy from a Git repository instead, see Deploying from a Git Repository. To run an image that is already built, see Deploying from a Docker Image.
When to use it
Use an uploaded source when:
- The code has no git remote.
- You have no registry where you can push an image.
- An AI coding agent writes the files locally and needs to deploy them.
- The working tree is dirty and you want to deploy the uncommitted changes as they are.
Deploy a directory
Pass the directory with --source. Use . for the current directory:
hostim deploy <app> --source . --plan sa-1-1 --port 8080
hostim deploy <app> --source ./api --dockerfile docker/Dockerfile --plan sa-1-1 --port 8080
The CLI packs the directory, uploads it, and Hostim builds it with the Dockerfile.
- The default Dockerfile is
Dockerfileat the directory root. --dockerfilesets a path inside the directory.- The directory that holds the Dockerfile is the build context.
The build works the same way as for a Git app. Follow the build log with hostim logs <app> --build. Read the build status with hostim status <app>.
A Dockerfile is required, except for a static site. If the directory has none, write one before you deploy. A multi-stage Dockerfile is fine.
Deploy a static site
A folder with an index.html at the root and no Dockerfile is deployed as a static site. The CLI adds an nginx Dockerfile and config, and the app listens on port 80, so --port is not needed:
npm run build
hostim deploy site --source dist --plan sa-1-1
Pass --static to force this mode when the folder has a Dockerfile. In static mode every file in the folder is uploaded, even when .gitignore lists it. See Hosting a Static Website for each generator.
What is uploaded
In a Git work tree, the CLI uploads the files Git sees: tracked files plus untracked files, minus the files in .gitignore. Uncommitted changes are included.
Outside Git, the CLI uploads every file.
The CLI always skips these:
.git/node_modules/.envand.env.*files
The files .env.example, .env.sample and .env.template are kept.
A .dockerignore at the directory root is applied too.
Limits and the 7-day expiry
The compressed upload must stay under 500 MiB.
If the upload is bigger, the CLI stops and lists the biggest files. Add those files to .dockerignore, then deploy again.
Hostim keeps the uploaded archive for 7 days.
- A running app keeps running after the archive expires.
- To rebuild after 7 days, run
hostim deploy <app> --source .again. The CLI uploads the directory again. hostim apps rebuildon an expired upload fails and tells you to deploy again.
Redeploying
Run the same command again:
hostim deploy <app> --source . --plan sa-1-1 --port 8080
The CLI uploads only if the content changed, and rebuilds the app.
Deploy a single jar or binary
A prebuilt artifact works too. Put the file next to a small Dockerfile and deploy the directory.
For example, with app.jar in the directory, use this Dockerfile:
FROM eclipse-temurin:21-jre
COPY app.jar /app.jar
CMD ["java","-jar","/app.jar"]
Then deploy:
hostim deploy <app> --source . --plan sa-1-1 --port 8080
Use it in a template
A template app can point at a local directory:
deploymentSource:
type: upload
upload:
path: . # relative to the template file
dockerfilepath: Dockerfile
Check the directory and the Dockerfile offline:
hostim templates validate -f stack.yml
Upload the directory and create every resource in the template:
hostim templates apply -f stack.yml
Use it from MCP
With hostim mcp, the create-app tool accepts source.type: "upload" and source.upload.path. See Use it from an AI agent (MCP).
Dashboard
An uploaded app shows "Deployed from an uploaded source archive" with the start of its SHA-256.
A new upload can come only from the CLI or MCP. The dashboard cannot start one.
Troubleshooting
The CLI says the directory has no Dockerfile. Add a Dockerfile at the directory root, or pass the correct path with --dockerfile. For a static site, pass the build folder (with its index.html) instead of the project folder. The path must be inside the directory you upload.
The upload is too big. The CLI lists the biggest files. Add them to .dockerignore at the directory root and deploy again. A file that is skipped is not in the build.
A file is missing from the build. Check .gitignore and .dockerignore. The CLI skips .env files and node_modules/ even if you do not list them. The Dockerfile's directory is the build context, so files outside it are not available to the build.
The build says "/dist": not found. The Dockerfile copies a build folder that .gitignore lists, so the CLI did not upload it. Build the site inside the Dockerfile, or deploy the build folder itself as a static site.
The build fails. Read the build log with hostim logs <app> --build. The build runs the Dockerfile, so a failure in the Dockerfile fails the deploy.
A rebuild fails after 7 days. The uploaded archive has expired. Run hostim deploy <app> --source . again to upload the current directory and rebuild.