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
|
RUN useradd -s /bin/bash nonroot
|
||||||
|
|
||||||
# Create working directory
|
# Create working directory
|
||||||
RUN mkdir -p /app
|
RUN mkdir -p /app /home/nonroot
|
||||||
RUN chown -R nonroot:nonroot /app
|
RUN chown -R nonroot:nonroot /app /home/nonroot
|
||||||
WORKDIR /app
|
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
|
# Switch user
|
||||||
USER nonroot
|
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 backend port
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user