Skip to content

Commit 1771d6e

Browse files
committed
chore: improve dev docker for offline + other fixes
1 parent c7157c8 commit 1771d6e

11 files changed

Lines changed: 39 additions & 17 deletions

.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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ 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
11+
- /workspace/.parcel-cache
12+
- /workspace/__pycache__
1113
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
1214
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: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
8989
ENV npm_config_loglevel warn
9090
# allow installing when the main user is root
9191
ENV npm_config_unsafe_perm true
92+
# disable NPM funding messages
93+
ENV npm_config_fund false
9294

9395
# Set locale to en_US.UTF-8
9496
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
@@ -114,10 +116,21 @@ RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
114116
# Colorize the bash shell
115117
RUN sed -i 's/#force_color_prompt=/force_color_prompt=/' /root/.bashrc
116118

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

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

docker/docker-compose.extend.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ services:
55
ports:
66
- '8000:8000'
77
volumes:
8-
- .:/root/src
9-
- /root/src/node_modules
8+
- .:/workspace
9+
- /workspace/node_modules
10+
- /workspace/.parcel-cache
11+
- /workspace/__pycache__
1012
db:
1113
ports:
1214
- '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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
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
npx parcel build
1212

@@ -76,7 +76,7 @@ for sub in \
7676
data/developers/www6/iesg/evaluation \
7777
data/developers/media/photo \
7878
; do
79-
dir="/root/src/$sub"
79+
dir="/workspace/$sub"
8080
if [ ! -d "$dir" ]; then
8181
echo "Creating dir $dir"
8282
mkdir -p "$dir";
@@ -86,7 +86,7 @@ done
8686
# Wait for DB container
8787
if [ -n "$EDITOR_VSCODE" ]; then
8888
echo "Waiting for DB container to come online ..."
89-
wget -qO- https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for | sh -s -- localhost:3306 -- echo "DB ready"
89+
/usr/local/bin/wait-for localhost:3306 -- echo "DB ready"
9090
fi
9191

9292
# 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)