1
- # Use the udx-worker as the base image
2
- FROM usabilitydynamics/udx-worker:0.12 .0
1
+ # Use the latest udx-worker as the base image
2
+ FROM usabilitydynamics/udx-worker:0.16 .0
3
3
4
4
# Add metadata labels
5
- LABEL maintainer="UDX"
6
- LABEL version="0.9.0"
5
+ LABEL version="0.11.0"
7
6
8
- # Set build arguments for Node.js version, application port, and log directory
9
- ARG NODE_VERSION=22.13.1
10
- ARG LOG_DIR=/var/log/udx-worker-nodejs
7
+ # Set build arguments for Node.js version and application port
8
+ ARG NODE_VERSION=22.14.0
11
9
ARG APP_PORT=8080
12
10
13
- # Set environment variables
14
- ENV HOME="/usr/src/app"
15
- ENV LOG_DIR="${LOG_DIR}"
16
- ENV APP_PORT="${APP_PORT}"
11
+ # Set application-specific environment variables
12
+ ENV APP_HOME="/usr/src/app" \
13
+ APP_PORT="${APP_PORT}"
17
14
18
- # Use root user for package installations and file permissions setup
15
+ # Use root user for Node.js installation
19
16
USER root
20
17
21
- # Set the shell with pipefail option
18
+ # Set shell with pipefail option for safer pipe operations
22
19
SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
23
20
21
+ # Set working directory for Node.js installation
22
+ WORKDIR /tmp
23
+
24
24
# Install Node.js
25
- ARG BUILDPLATFORM
26
25
RUN set -ex && \
27
- # Parse platform architecture
28
- case "${BUILDPLATFORM}" in \
29
- "linux/amd64" ) ARCH="x64" ;; \
30
- "linux/arm64" ) ARCH="arm64" ;; \
31
- *) echo "Unsupported platform: ${BUILDPLATFORM}" && exit 1 ;; \
32
- esac && \
33
- # Download and install Node.js for the build platform
34
- curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" -o node.tar.xz && \
35
- tar -xJf node.tar.xz && \
36
- mv "node-v${NODE_VERSION}-linux-${ARCH}" /usr/local/node && \
26
+ # Detect architecture
27
+ ARCH=$(dpkg --print-architecture 2>/dev/null || echo "x64" ) && \
28
+ if [ "$ARCH" = "amd64" ]; then ARCH="x64" ; fi && \
29
+ if [ "$ARCH" = "arm64" ]; then ARCH="arm64" ; fi && \
30
+ # Download Node.js binary and checksum
31
+ curl -fsSLO "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" && \
32
+ curl -fsSLO "https://nodejs.org/dist/v${NODE_VERSION}/SHASUMS256.txt" && \
33
+ # Verify checksum
34
+ grep " node-v${NODE_VERSION}-linux-${ARCH}.tar.xz\$ " SHASUMS256.txt | sha256sum -c - && \
35
+ # Extract and install
36
+ mkdir -p /usr/local/node && \
37
+ tar -xJf "node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" --strip-components=1 -C /usr/local/node && \
38
+ # Create symlinks
37
39
ln -sf /usr/local/node/bin/node /usr/local/bin/node && \
38
40
ln -sf /usr/local/node/bin/npm /usr/local/bin/npm && \
39
41
ln -sf /usr/local/node/bin/npx /usr/local/bin/npx && \
40
- # Clean up
41
- rm node.tar.xz && \
42
- rm -rf /tmp/* /var/tmp/*
42
+ # Verify installation
43
+ node --version && \
44
+ npm --version && \
45
+ # Cleanup
46
+ rm -rf /tmp/*
43
47
44
48
# Copy application files
45
- COPY src/index.js "${HOME}/index.js"
46
- COPY src/configs/services.yaml /usr/local/configs/worker/services.yaml
47
- COPY src/tests/ "${HOME}/tests/"
48
- COPY LICENSE "${HOME}/LICENSE "
49
+ # Create application directory
50
+ RUN mkdir -p "${APP_HOME}" && \
51
+ chown -R "${USER}:${USER}" "${APP_HOME}" && \
52
+ chmod -R 755 "${APP_HOME} "
49
53
50
- # Ensure the log directory exists, then adjust permissions
51
- RUN mkdir -p "${LOG_DIR}" \
52
- && chown -R "${USER}:${USER}" "${HOME}" "${HOME}/tests" "${LOG_DIR}" \
53
- && chmod -R 755 "${HOME}" "${LOG_DIR}"
54
+ # Copy license and examples
55
+ COPY --chown=${USER}:${USER} LICENSE "${APP_HOME}/LICENSE"
54
56
55
57
# Expose the application port
56
58
EXPOSE ${APP_PORT}
57
59
58
- # Switch to the non-root user
60
+ # Switch to the non-root user and set working directory
59
61
USER "${USER}"
62
+ WORKDIR "${APP_HOME}"
60
63
61
- # Set the working directory
62
- WORKDIR "${HOME}"
64
+ # Use the parent image's entrypoint
65
+ ENTRYPOINT [ "/usr/local/worker/bin/entrypoint.sh" ]
63
66
64
- # Set the default command
67
+ # Use the default command from parent image
65
68
CMD ["tail" , "-f" , "/dev/null" ]
0 commit comments