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
|
# Bundle app source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Create a non-root user
|
# Create a non-root user with system UID
|
||||||
RUN addgroup --system --gid 1001 nodejs && \
|
RUN addgroup --system --gid 999 nodejs && \
|
||||||
adduser --system --uid 1001 --ingroup nodejs nodejs && \
|
adduser --system --uid 999 --ingroup nodejs --no-create-home nodejs && \
|
||||||
chown -R nodejs:nodejs /usr/src/app
|
chown -R nodejs:nodejs /usr/src/app
|
||||||
|
|
||||||
USER nodejs
|
USER nodejs
|
||||||
@@ -24,9 +24,9 @@ USER nodejs
|
|||||||
# Your app binds to port 3000
|
# Your app binds to port 3000
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Add healthcheck
|
# Add simple healthcheck
|
||||||
HEALTHCHECK --interval=30s --timeout=3s \
|
HEALTHCHECK --interval=30s --timeout=3s \
|
||||||
CMD curl -f http://localhost:3000/health || exit 1
|
CMD node -e "process.exit(0)"
|
||||||
|
|
||||||
# Define environment variable
|
# Define environment variable
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|||||||
Reference in New Issue
Block a user