Gas Station Feature
This commit is contained in:
@@ -35,12 +35,19 @@ FROM nginx:alpine AS production
|
||||
RUN addgroup -g 1001 -S nodejs && \
|
||||
adduser -S nodejs -u 1001 -G nginx
|
||||
|
||||
# Copy built assets from build stage
|
||||
# Copy built assets from build stage
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
# Copy nginx configuration
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Copy and prepare config loader script
|
||||
COPY scripts/load-config.sh /app/load-config.sh
|
||||
RUN chmod +x /app/load-config.sh
|
||||
|
||||
# Set environment variable for secrets directory
|
||||
ENV SECRETS_DIR=/run/secrets
|
||||
|
||||
# Set up proper permissions for nginx with non-root user
|
||||
RUN chown -R nodejs:nginx /usr/share/nginx/html && \
|
||||
chown -R nodejs:nginx /var/cache/nginx && \
|
||||
@@ -48,7 +55,8 @@ RUN chown -R nodejs:nginx /usr/share/nginx/html && \
|
||||
chown -R nodejs:nginx /etc/nginx/conf.d && \
|
||||
chown nodejs:nginx /etc/nginx/nginx.conf && \
|
||||
touch /var/run/nginx.pid && \
|
||||
chown -R nodejs:nginx /var/run/nginx.pid
|
||||
chown -R nodejs:nginx /var/run/nginx.pid && \
|
||||
chown nodejs:nginx /app/load-config.sh
|
||||
|
||||
# Switch to non-root user
|
||||
USER nodejs
|
||||
@@ -60,5 +68,5 @@ EXPOSE 3000 3443
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget --quiet --tries=1 --spider http://localhost:3000/ || exit 1
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# Start: load config then start nginx
|
||||
CMD ["sh", "-c", "/app/load-config.sh && nginx -g 'daemon off;'"]
|
||||
Reference in New Issue
Block a user