Speed_Read_AI / Dockerfile
circulartext's picture
Update Dockerfile
649c393
raw
history blame
1.06 kB
# Use the base Docker image with necessary dependencies
FROM circulartextapp/spaceread as base
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Define the user ID in the environment variable USER_ID with a default value
ARG USER_ID=1000
ENV USER_ID=$USER_ID
# Check if the user already exists
RUN if id "$USER_ID" >/dev/null 2>&1; then \
echo "User with ID $USER_ID already exists."; \
else \
useradd -m -u "$USER_ID" user; \
fi
# Set appropriate permissions for the application directory
RUN chown -R user:user /app
# Switch to the user for improved security
USER user
# Multi-stage build for installing gosu
FROM alpine as gosu_installer
# Install gosu in the alpine image
RUN apk --no-cache add gosu
# Final stage
FROM base
# Copy gosu from the gosu_installer image
COPY --from=gosu_installer /usr/sbin/gosu /usr/sbin/gosu
# Copy entrypoint.sh separately
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh