Update Dockerfile
Browse files- Dockerfile +14 -1
Dockerfile
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
|
|
| 1 |
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5-204
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
COPY app/* /app/
|
| 6 |
|
|
|
|
| 7 |
USER root
|
| 8 |
|
|
|
|
| 9 |
RUN microdnf update -y && \
|
| 10 |
rm -rf /var/cache/yum && \
|
| 11 |
microdnf install nodejs && \
|
|
@@ -19,8 +24,16 @@ RUN microdnf update -y && \
|
|
| 19 |
npm install --unsafe-perm && \
|
| 20 |
chown -R 1001:0 /app
|
| 21 |
|
|
|
|
| 22 |
USER 1001
|
| 23 |
|
|
|
|
| 24 |
EXPOSE 8000
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Red Hat UBI minimal image
|
| 2 |
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5-204
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy application files
|
| 8 |
COPY app/* /app/
|
| 9 |
|
| 10 |
+
# Switch to root user to install necessary packages
|
| 11 |
USER root
|
| 12 |
|
| 13 |
+
# Update and install dependencies
|
| 14 |
RUN microdnf update -y && \
|
| 15 |
rm -rf /var/cache/yum && \
|
| 16 |
microdnf install nodejs && \
|
|
|
|
| 24 |
npm install --unsafe-perm && \
|
| 25 |
chown -R 1001:0 /app
|
| 26 |
|
| 27 |
+
# Switch back to a non-root user for security
|
| 28 |
USER 1001
|
| 29 |
|
| 30 |
+
# Expose the application port
|
| 31 |
EXPOSE 8000
|
| 32 |
|
| 33 |
+
# Define environment variables (optional, you can set them at runtime too)
|
| 34 |
+
ENV REMOTE_HOST=your.remote.host
|
| 35 |
+
ENV REMOTE_USERNAME=username
|
| 36 |
+
ENV REMOTE_PASSWORD=password
|
| 37 |
+
|
| 38 |
+
# Start the Node.js server
|
| 39 |
+
CMD [ "node", "server.js" ]
|