Dev (#7)
* health check * Update Dockerfile * simplifying the deployment
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -14,9 +14,9 @@ RUN npm ci --only=production
|
||||
# Bundle app source
|
||||
COPY . .
|
||||
|
||||
# Create a non-root user
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 --ingroup nodejs nodejs && \
|
||||
# Create a non-root user with system UID
|
||||
RUN addgroup --system --gid 999 nodejs && \
|
||||
adduser --system --uid 999 --ingroup nodejs --no-create-home nodejs && \
|
||||
chown -R nodejs:nodejs /usr/src/app
|
||||
|
||||
USER nodejs
|
||||
@@ -24,9 +24,9 @@ USER nodejs
|
||||
# Your app binds to port 3000
|
||||
EXPOSE 3000
|
||||
|
||||
# Add healthcheck
|
||||
# Add simple healthcheck
|
||||
HEALTHCHECK --interval=30s --timeout=3s \
|
||||
CMD curl -f http://localhost:3000/health || exit 1
|
||||
CMD node -e "process.exit(0)"
|
||||
|
||||
# Define environment variable
|
||||
ENV NODE_ENV=production
|
||||
|
||||
Reference in New Issue
Block a user