docker:local command

This commit is contained in:
2026-04-05 23:30:26 -04:00
parent 5116661847
commit 807146e26e
5 changed files with 92 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
FROM node:20
# Install SpacetimeDB CLI
RUN apt-get update && apt-get install -y curl && \
curl --proto '=https' --tlsv1.2 -sSf https://install.spacetimedb.com | sh -s -- -y
# Add to path
ENV PATH="/root/.local/bin:${PATH}"
WORKDIR /module
COPY . .
# Run the publish command. We use a shell loop to wait for the DB to be ready.
CMD echo "Waiting for SpacetimeDB at ${SPACETIMEDB_URI}..." && \
while ! curl -s ${SPACETIMEDB_URI}/api/v1/identity; do sleep 2; done; \
echo "Publishing module ${SPACETIMEDB_DB_NAME} to ${SPACETIMEDB_URI}..." && \
spacetime server add --url ${SPACETIMEDB_URI} deploy_target && \
spacetime publish --server deploy_target --delete-data=on-conflict ${SPACETIMEDB_DB_NAME} -y