Skip to content

Commit d944ffe

Browse files
committed
Make Dockerfile.dev built containers a drop-in for production images.
Without this change, you can't easily swap a dev container for a production (release) container because there are fundamental differences. Allowing it to be a drop-in replacement makes it easier to test on real fabrics. - Use the same (environment variable) mechanism for configuring the default data path for consistent overrides. - Use the same uid (1000) so permissions match. - Add --ignore-scripts to npm ci to prevent build lifecycle scripts from running before source code is copied.
1 parent 1f59aff commit d944ffe

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

docker/matterjs-server/Dockerfile.dev

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,21 @@ COPY packages/dashboard/package*.json ./packages/dashboard/
3131
COPY packages/matter-server/package*.json ./packages/matter-server/
3232

3333
# Install dependencies
34-
RUN npm ci
34+
RUN npm ci --ignore-scripts
3535

3636
# Copy source code
3737
COPY . .
3838

3939
# Build all packages
4040
RUN npm run build
4141

42+
# Initialize data volume with user permissions
43+
RUN mkdir -p /data && chown -R 1000:1000 /data
44+
45+
# Environment variables with defaults
46+
ENV LOG_LEVEL=info
47+
ENV STORAGE_PATH=/data
48+
4249
# Data volume for persistent storage
4350
VOLUME ["/data"]
4451

@@ -53,7 +60,10 @@ COPY --chmod=0755 docker/matterjs-server/healthcheck.sh /usr/local/bin/healthche
5360
HEALTHCHECK --interval=60s --timeout=10s --start-period=30s --start-interval=5s --retries=3 \
5461
CMD ["/usr/local/bin/healthcheck.sh"]
5562

63+
# Run as non-root user
64+
USER 1000:1000
65+
5666
# Run the matter server with data stored in /data
5767
# --enable-source-maps provides better stack traces in error logs
5868
ENTRYPOINT ["node", "--enable-source-maps", "packages/matter-server/dist/esm/MatterServer.js"]
59-
CMD ["--storage-path", "/data"]
69+
CMD []

0 commit comments

Comments
 (0)