No longer generating refresh token while building the container. Also switching to nonroot user before copying files and installing dependencies.
This commit is contained in:
+11
-7
@@ -14,18 +14,22 @@ RUN apt update && apt upgrade -y && \
|
||||
RUN useradd -s /bin/bash nonroot
|
||||
|
||||
# Create working directory
|
||||
RUN mkdir -p /app
|
||||
RUN chown -R nonroot:nonroot /app
|
||||
RUN mkdir -p /app /home/nonroot
|
||||
RUN chown -R nonroot:nonroot /app /home/nonroot
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
# Generate a random hex token and write it to .env
|
||||
RUN echo "REFRESH_TOKEN_SECRET = $(openssl rand -hex 32)" >> /app/.env
|
||||
RUN npm install
|
||||
|
||||
# Switch user
|
||||
USER nonroot
|
||||
|
||||
# Copy contents
|
||||
COPY . .
|
||||
|
||||
# Generate a random hex token and write it to .env
|
||||
#RUN echo "REFRESH_TOKEN_SECRET = $(openssl rand -hex 32)" >> /app/.env
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Expose backend port
|
||||
EXPOSE 8000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user