diff --git a/mongo/6/Dockerfile b/mongo/6/Dockerfile index ed34b43a..4127f4c4 100644 --- a/mongo/6/Dockerfile +++ b/mongo/6/Dockerfile @@ -1 +1,11 @@ FROM mongo:6.0.11 + +# Health check +HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD ["mongosh", "--eval", "db.adminCommand('ping')"] + +# Non-root user (default) +USER mongodb + +# Start with custom config to keep resource usage down +COPY --chown=mongodb:mongodb ../mongod.conf /etc/ +CMD ["mongod", "--config", "/etc/mongod.conf"] diff --git a/mongo/6/mongod.conf b/mongo/6/mongod.conf new file mode 100644 index 00000000..cb82d81b --- /dev/null +++ b/mongo/6/mongod.conf @@ -0,0 +1,10 @@ +setParameter: + maxIndexBuildMemoryUsageMegabytes: 50 +storage: + wiredTiger: + engineConfig: + cacheSizeGB: 0.25 + journalCompressor: zstd + zstdCompressionLevel: 22 + collectionConfig: + blockCompressor: zstd diff --git a/mongo/7/Dockerfile b/mongo/7/Dockerfile index fed16fe9..58cec0da 100644 --- a/mongo/7/Dockerfile +++ b/mongo/7/Dockerfile @@ -1 +1,11 @@ FROM mongo:7.0.2 + +# Health check +HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD ["mongosh", "--eval", "db.adminCommand('ping')"] + +# Non-root user (default) +USER mongodb + +# Start with custom config to keep resource usage down +COPY --chown=mongodb:mongodb ../mongod.conf /etc/ +CMD ["mongod", "--config", "/etc/mongod.conf"] diff --git a/mongo/7/mongod.conf b/mongo/7/mongod.conf new file mode 100644 index 00000000..cb82d81b --- /dev/null +++ b/mongo/7/mongod.conf @@ -0,0 +1,10 @@ +setParameter: + maxIndexBuildMemoryUsageMegabytes: 50 +storage: + wiredTiger: + engineConfig: + cacheSizeGB: 0.25 + journalCompressor: zstd + zstdCompressionLevel: 22 + collectionConfig: + blockCompressor: zstd