Skip to content

Commit 868afd2

Browse files
authored
chore: improve dev docker for offline + other fixes (ietf-tools#3652)
1 parent aa718e7 commit 868afd2

File tree

10 files changed

+37
-19
lines changed

10 files changed

+37
-19
lines changed

.devcontainer/devcontainer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "IETF Datatracker",
55
"dockerComposeFile": ["../docker-compose.yml", "docker-compose.extend.yml"],
66
"service": "app",
7-
"workspaceFolder": "/root/src",
7+
"workspaceFolder": "/workspace",
88
"shutdownAction": "stopCompose",
99
"postCreateCommand": "/docker-init.sh",
1010
"containerEnv": {
@@ -69,7 +69,10 @@
6969
"spmeesseman.vscode-taskexplorer",
7070
"mtxr.sqltools",
7171
"mtxr.sqltools-driver-mysql",
72-
"mrmlnc.vscode-duplicate"
72+
"mrmlnc.vscode-duplicate",
73+
"eamodio.gitlens",
74+
"oderwat.indent-rainbow",
75+
"johnsoncodehk.volar"
7376
],
7477

7578
// Use 'forwardPorts' to make a list of ports inside the container available locally.

.devcontainer/docker-compose.extend.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
EDITOR_VSCODE: 1
77
DJANGO_SETTINGS_MODULE: settings_local_sqlitetest
88
volumes:
9-
- .:/root/src
10-
- /root/src/node_modules
9+
- .:/workspace
10+
- /workspace/node_modules
1111
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
1212
network_mode: service:db

.npmrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
save-exact = true
2-
save-prefix = ""
2+
save-prefix = ""
3+
fund = false
4+
loglevel = "warn"

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"**/third_party/**",
2121
"**/vendor/**",
2222
"**/work/**",
23-
"/root/src/bootstrap/nuget/MyGet.ps1"
23+
"/workspace/bootstrap/nuget/MyGet.ps1"
2424
],
2525
"taskExplorer.enableAnt": false,
2626
"taskExplorer.enableAppPublisher": false,

docker/app.Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
8888
ENV npm_config_loglevel warn
8989
# allow installing when the main user is root
9090
ENV npm_config_unsafe_perm true
91+
# disable NPM funding messages
92+
ENV npm_config_fund false
9193

9294
# Set locale to en_US.UTF-8
9395
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
@@ -99,7 +101,7 @@ RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
99101
ENV LC_ALL en_US.UTF-8
100102

101103
# Install bower
102-
RUN npm install -g bower
104+
RUN npm install -g bower grunt-cli
103105

104106
# Install idnits
105107
ADD https://raw.githubusercontent.com/ietf-tools/idnits-mirror/main/idnits /usr/local/bin/
@@ -116,10 +118,21 @@ RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
116118
# Colorize the bash shell
117119
RUN sed -i 's/#force_color_prompt=/force_color_prompt=/' /root/.bashrc
118120

121+
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
122+
RUN chmod +rx /usr/local/bin/wait-for
123+
119124
# Copy the startup file
120125
COPY docker/scripts/app-init.sh /docker-init.sh
121126
RUN sed -i 's/\r$//' /docker-init.sh && \
122127
chmod +x /docker-init.sh
123128

124-
WORKDIR /root/src
129+
# Create workspace
130+
RUN mkdir -p /workspace
131+
WORKDIR /workspace
132+
133+
# Install NPM modules
134+
COPY package.json package.json
135+
RUN npm install --no-audit
136+
RUN rm -f package.json package-lock.json
137+
125138
# ENTRYPOINT [ "/docker-init.sh" ]

docker/docker-compose.extend.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ services:
55
ports:
66
- '8000:8000'
77
volumes:
8-
- .:/root/src
9-
- /root/src/node_modules
8+
- .:/workspace
9+
- /workspace/node_modules
1010
db:
1111
ports:
1212
- '3306'

docker/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
cd ..
44
docker-compose -f docker-compose.yml -f docker/docker-compose.extend.yml up -d
55
docker-compose exec app /bin/sh /docker-init.sh
6-
docker-compose down
6+
docker-compose stop
77
cd docker

docker/scripts/app-cypress.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
WORKSPACEDIR="/root/src"
3+
WORKSPACEDIR="/workspace"
44

55
pushd .
66
cd $WORKSPACEDIR

docker/scripts/app-init.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/bin/bash
22

3-
WORKSPACEDIR="/root/src"
3+
WORKSPACEDIR="/workspace"
44

55
service rsyslog start
66

77
# Generate static assets
88

9-
npm install
9+
npm install --prefer-offline --no-audit
1010
echo "Building static assets... (this could take a minute or two)"
1111
cd bootstrap
12-
npm install -g grunt-cli
13-
npm install
12+
npm install -g grunt-cli --prefer-offline --no-audit
13+
npm install --prefer-offline --no-audit
1414
grunt dist
1515
cp -r dist/. ../ietf/static/ietf/bootstrap/
1616
cd ..
@@ -81,7 +81,7 @@ for sub in \
8181
data/developers/www6/iesg/evaluation \
8282
data/developers/media/photo \
8383
; do
84-
dir="/root/src/$sub"
84+
dir="/workspace/$sub"
8585
if [ ! -d "$dir" ]; then
8686
echo "Creating dir $dir"
8787
mkdir -p "$dir";
@@ -91,7 +91,7 @@ done
9191
# Wait for DB container
9292
if [ -n "$EDITOR_VSCODE" ]; then
9393
echo "Waiting for DB container to come online ..."
94-
wget -qO- https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for | sh -s -- localhost:3306 -- echo "DB ready"
94+
/usr/local/bin/wait-for localhost:3306 -- echo "DB ready"
9595
fi
9696

9797
# Initial checks

docker/scripts/app-win32-timezone-fix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
WORKSPACEDIR="/root/src"
3+
WORKSPACEDIR="/workspace"
44

55
ICSFILES=$(/usr/bin/find $WORKSPACEDIR/vzic/zoneinfo/ -name '*.ics' -print)
66
for ICSFILE in $ICSFILES

0 commit comments

Comments
 (0)