-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.linux
More file actions
52 lines (40 loc) · 1.31 KB
/
Dockerfile.linux
File metadata and controls
52 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Dockerfile for testing npm-practice on Linux
FROM node:20-bookworm
# Install dependencies needed for testing
RUN apt-get update && apt-get install -y \
curl \
git \
sudo \
lsof \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates
# Configure npm with relaxed SSL for Docker environment and increased timeouts
RUN npm config set strict-ssl false && \
npm config set fetch-timeout 60000 && \
npm config set fetch-retry-maxtimeout 120000
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy all project files
COPY . .
# Create a test user and give sudo access without password
RUN useradd -m -s /bin/bash tester && \
chown -R tester:tester /app && \
echo "tester ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Switch to test user
USER tester
# Configure npm for tester user with relaxed SSL for Docker environment
RUN npm config set strict-ssl false && \
npm config set fetch-timeout 60000 && \
npm config set fetch-retry-maxtimeout 120000
# Set up environment
ENV HOME=/home/tester
WORKDIR /home/tester/test-workspace
# Copy app to home directory so we can test it
RUN cp -r /app /home/tester/npm-practice-source
# Default command: open bash for interactive testing
CMD ["/bin/bash"]