chore: improve dev docker for offline + other fixes

This commit is contained in:
NGPixel 2022-03-15 22:22:30 -04:00
parent c7157c80c5
commit 1771d6ea77
No known key found for this signature in database
GPG key ID: 8FDA2F1757F60D63
11 changed files with 39 additions and 17 deletions

View file

@ -4,7 +4,7 @@
"name": "IETF Datatracker", "name": "IETF Datatracker",
"dockerComposeFile": ["../docker-compose.yml", "docker-compose.extend.yml"], "dockerComposeFile": ["../docker-compose.yml", "docker-compose.extend.yml"],
"service": "app", "service": "app",
"workspaceFolder": "/root/src", "workspaceFolder": "/workspace",
"shutdownAction": "stopCompose", "shutdownAction": "stopCompose",
"postCreateCommand": "/docker-init.sh", "postCreateCommand": "/docker-init.sh",
"containerEnv": { "containerEnv": {
@ -69,7 +69,10 @@
"spmeesseman.vscode-taskexplorer", "spmeesseman.vscode-taskexplorer",
"mtxr.sqltools", "mtxr.sqltools",
"mtxr.sqltools-driver-mysql", "mtxr.sqltools-driver-mysql",
"mrmlnc.vscode-duplicate" "mrmlnc.vscode-duplicate",
"eamodio.gitlens",
"oderwat.indent-rainbow",
"johnsoncodehk.volar"
], ],
// Use 'forwardPorts' to make a list of ports inside the container available locally. // Use 'forwardPorts' to make a list of ports inside the container available locally.

View file

@ -6,7 +6,9 @@ services:
EDITOR_VSCODE: 1 EDITOR_VSCODE: 1
DJANGO_SETTINGS_MODULE: settings_local_sqlitetest DJANGO_SETTINGS_MODULE: settings_local_sqlitetest
volumes: volumes:
- .:/root/src - .:/workspace
- /root/src/node_modules - /workspace/node_modules
- /workspace/.parcel-cache
- /workspace/__pycache__
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db network_mode: service:db

4
.npmrc
View file

@ -1,2 +1,4 @@
save-exact = true save-exact = true
save-prefix = "" save-prefix = ""
fund = false
loglevel = "warn"

View file

@ -20,7 +20,7 @@
"**/third_party/**", "**/third_party/**",
"**/vendor/**", "**/vendor/**",
"**/work/**", "**/work/**",
"/root/src/bootstrap/nuget/MyGet.ps1" "/workspace/bootstrap/nuget/MyGet.ps1"
], ],
"taskExplorer.enableAnt": false, "taskExplorer.enableAnt": false,
"taskExplorer.enableAppPublisher": false, "taskExplorer.enableAppPublisher": false,

View file

@ -89,6 +89,8 @@ ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
ENV npm_config_loglevel warn ENV npm_config_loglevel warn
# allow installing when the main user is root # allow installing when the main user is root
ENV npm_config_unsafe_perm true ENV npm_config_unsafe_perm true
# disable NPM funding messages
ENV npm_config_fund false
# Set locale to en_US.UTF-8 # Set locale to en_US.UTF-8
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \ RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
@ -114,10 +116,21 @@ RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
# Colorize the bash shell # Colorize the bash shell
RUN sed -i 's/#force_color_prompt=/force_color_prompt=/' /root/.bashrc RUN sed -i 's/#force_color_prompt=/force_color_prompt=/' /root/.bashrc
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
RUN chmod +rx /usr/local/bin/wait-for
# Copy the startup file # Copy the startup file
COPY docker/scripts/app-init.sh /docker-init.sh COPY docker/scripts/app-init.sh /docker-init.sh
RUN sed -i 's/\r$//' /docker-init.sh && \ RUN sed -i 's/\r$//' /docker-init.sh && \
chmod +x /docker-init.sh chmod +x /docker-init.sh
WORKDIR /root/src # Create workspace
RUN mkdir -p /workspace
WORKDIR /workspace
# Install NPM modules
COPY package.json package.json
RUN npm install --no-audit
RUN rm -f package.json package-lock.json
# ENTRYPOINT [ "/docker-init.sh" ] # ENTRYPOINT [ "/docker-init.sh" ]

View file

@ -5,8 +5,10 @@ services:
ports: ports:
- '8000:8000' - '8000:8000'
volumes: volumes:
- .:/root/src - .:/workspace
- /root/src/node_modules - /workspace/node_modules
- /workspace/.parcel-cache
- /workspace/__pycache__
db: db:
ports: ports:
- '3306' - '3306'

View file

@ -3,5 +3,5 @@
cd .. cd ..
docker-compose -f docker-compose.yml -f docker/docker-compose.extend.yml up -d docker-compose -f docker-compose.yml -f docker/docker-compose.extend.yml up -d
docker-compose exec app /bin/sh /docker-init.sh docker-compose exec app /bin/sh /docker-init.sh
docker-compose down docker-compose stop
cd docker cd docker

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
WORKSPACEDIR="/root/src" WORKSPACEDIR="/workspace"
pushd . pushd .
cd $WORKSPACEDIR cd $WORKSPACEDIR

View file

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
WORKSPACEDIR="/root/src" WORKSPACEDIR="/workspace"
service rsyslog start service rsyslog start
# Generate static assets # Generate static assets
npm install npm install --prefer-offline --no-audit
echo "Building static assets... (this could take a minute or two)" echo "Building static assets... (this could take a minute or two)"
npx parcel build npx parcel build
@ -76,7 +76,7 @@ for sub in \
data/developers/www6/iesg/evaluation \ data/developers/www6/iesg/evaluation \
data/developers/media/photo \ data/developers/media/photo \
; do ; do
dir="/root/src/$sub" dir="/workspace/$sub"
if [ ! -d "$dir" ]; then if [ ! -d "$dir" ]; then
echo "Creating dir $dir" echo "Creating dir $dir"
mkdir -p "$dir"; mkdir -p "$dir";
@ -86,7 +86,7 @@ done
# Wait for DB container # Wait for DB container
if [ -n "$EDITOR_VSCODE" ]; then if [ -n "$EDITOR_VSCODE" ]; then
echo "Waiting for DB container to come online ..." echo "Waiting for DB container to come online ..."
wget -qO- https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for | sh -s -- localhost:3306 -- echo "DB ready" /usr/local/bin/wait-for localhost:3306 -- echo "DB ready"
fi fi
# Initial checks # Initial checks

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
WORKSPACEDIR="/root/src" WORKSPACEDIR="/workspace"
ICSFILES=$(/usr/bin/find $WORKSPACEDIR/vzic/zoneinfo/ -name '*.ics' -print) ICSFILES=$(/usr/bin/find $WORKSPACEDIR/vzic/zoneinfo/ -name '*.ics' -print)
for ICSFILE in $ICSFILES for ICSFILE in $ICSFILES

2
package-lock.json generated
View file

@ -1,5 +1,5 @@
{ {
"name": "src", "name": "workspace",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {