Skip to content

Commit 1e77253

Browse files
committed
update(docker): healthcheck port & path + cleanup
1 parent d349a75 commit 1e77253

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
node_modules
2+
.git
3+
.github
4+
.vscode
25
dist
36
build
47
.env

Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ RUN apk add --no-cache --update \
3636

3737
FROM builder-${VARIANT} AS builder
3838

39+
# Set environment variables
40+
ENV NPM_CONFIG_LOGLEVEL=error \
41+
VITE_BUILD_ENV=production
42+
3943
# Set the working directory
4044
WORKDIR /app
4145

@@ -56,7 +60,6 @@ RUN rm -rf src/routes/\(docs\) && \
5660
chmod -R 750 uploads database
5761

5862
# Build the application and remove `devDependencies`
59-
ENV VITE_BUILD_ENV=production
6063
RUN npm run build && \
6164
npm prune --omit=dev
6265

@@ -84,7 +87,10 @@ ARG PORT=3000 \
8487
USERNAME=node
8588

8689
# Set environment variables
87-
ENV NODE_ENV=production \
90+
ENV HEALTHCHECK_PORT=$PORT \
91+
HEALTHCHECK_PATH= \
92+
NODE_ENV=production \
93+
NPM_CONFIG_LOGLEVEL=error \
8894
PORT=$PORT \
8995
TZ=Etc/UTC
9096

@@ -121,7 +127,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &
121127
EXPOSE $PORT
122128

123129
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
124-
CMD wget --method=HEAD --quiet --spider http://localhost:$PORT || exit 1
130+
CMD wget --quiet --spider http://localhost:$HEALTHCHECK_PORT$HEALTHCHECK_PATH || exit 1
125131

126132
# Use a non-root user (recommended for security)
127133
USER $USERNAME

0 commit comments

Comments
 (0)