19 lines
724 B
Docker
19 lines
724 B
Docker
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
|