mirror of
https://github.com/glenndehaan/unifi-voucher-site.git
synced 2026-04-05 08:54:17 -04:00
Updated 404 and login branding/layout. Moved tailwind dependencies to dev-dependencies. Patched follow-redirects. Implemented separate dependencies stage within Dockerfile to shrink image size.
This commit is contained in:
41
Dockerfile
41
Dockerfile
@@ -1,11 +1,11 @@
|
||||
#=====================================================
|
||||
# Build Stage
|
||||
# Build Stage (1/2)
|
||||
#=====================================================
|
||||
|
||||
#
|
||||
# Define OS
|
||||
#
|
||||
FROM alpine:3.19 AS app
|
||||
FROM alpine:3.19 AS dependencies
|
||||
|
||||
#
|
||||
# Basic OS management
|
||||
@@ -27,6 +27,35 @@ COPY ./package.json ./package-lock.json ./
|
||||
# Install dependencies
|
||||
RUN npm ci --only=production && npm cache clean --force
|
||||
|
||||
#=====================================================
|
||||
# Build Stage (2/2)
|
||||
#=====================================================
|
||||
|
||||
#
|
||||
# Define OS
|
||||
#
|
||||
FROM alpine:3.19 AS css
|
||||
|
||||
#
|
||||
# Basic OS management
|
||||
#
|
||||
|
||||
# Install packages
|
||||
RUN apk add --no-cache nodejs npm
|
||||
|
||||
#
|
||||
# Require app
|
||||
#
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /app
|
||||
|
||||
# Bundle package.json and package-lock.json
|
||||
COPY ./package.json ./package-lock.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci && npm cache clean --force
|
||||
|
||||
# Bundle application source
|
||||
COPY . .
|
||||
|
||||
@@ -66,6 +95,10 @@ EXPOSE 3000
|
||||
# Set node env
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Setup healthcheck
|
||||
HEALTHCHECK --interval=10s --timeout=3s \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/_health || exit 1
|
||||
|
||||
# Run app
|
||||
CMD ["dumb-init", "node", "/app/server.js"]
|
||||
|
||||
@@ -74,6 +107,6 @@ CMD ["dumb-init", "node", "/app/server.js"]
|
||||
#
|
||||
|
||||
# Bundle from build image
|
||||
COPY --from=app /app/node_modules ./node_modules
|
||||
COPY --from=app /app/public/dist ./public/dist
|
||||
COPY --from=dependencies /app/node_modules ./node_modules
|
||||
COPY --from=css /app/public/dist ./public/dist
|
||||
COPY . .
|
||||
|
||||
Reference in New Issue
Block a user