Corrected storage issue by adding a docker volume for file persistance
This commit is contained in:
parent
e44bc95a4e
commit
38532056e5
4 changed files with 30 additions and 5 deletions
|
|
@ -72,10 +72,18 @@ RUN useradd --system --uid 10001 --no-create-home --shell /usr/sbin/nologin appu
|
|||
# Copy the compiled binary from the builder stage
|
||||
|
||||
COPY --from=builder /usr/src/app/target/release/rust-engine /usr/local/bin/rust-engine
|
||||
|
||||
# Create writable storage and logs directories for appuser
|
||||
RUN chown appuser:appuser /usr/local/bin/rust-engine \
|
||||
&& mkdir -p /var/log \
|
||||
&& mkdir -p /var/log /app/storage /app/demo-data \
|
||||
&& touch /var/log/astra-errors.log \
|
||||
&& chown appuser:appuser /var/log/astra-errors.log
|
||||
&& chown -R appuser:appuser /var/log /app
|
||||
|
||||
# Set working directory to a writable location
|
||||
WORKDIR /app
|
||||
|
||||
# Switch to non-root user
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8000
|
||||
# Redirect all output to /var/log/astra-errors.log for easy monitoring
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};
|
|||
pub fn storage_dir() -> PathBuf {
|
||||
std::env::var("ASTRA_STORAGE")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|_| std::env::current_dir().unwrap().join("storage"))
|
||||
.unwrap_or_else(|_| PathBuf::from("/app/storage"))
|
||||
}
|
||||
|
||||
pub fn ensure_storage_dir() -> Result<()> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue