forked from advplyr/audiobookshelf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating devcontainer setup and related documentation
- Loading branch information
Showing
9 changed files
with
273 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:16 | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get install ffmpeg gnupg2 -y | ||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster | ||
ARG VARIANT=16 | ||
FROM mcr.microsoft.com/devcontainers/javascript-node:0-${VARIANT} as base | ||
|
||
# Setup the node environment | ||
ENV NODE_ENV=development | ||
|
||
# Install additional OS packages. | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ | ||
curl tzdata ffmpeg && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Move tone executable to appropriate directory | ||
COPY --from=sandreas/tone:v0.1.2 /usr/local/bin/tone /usr/local/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Using port 3333 is important when running the client web app separately | ||
const Path = require('path') | ||
module.exports.config = { | ||
Port: 3333, | ||
ConfigPath: Path.resolve('config'), | ||
MetadataPath: Path.resolve('metadata'), | ||
FFmpegPath: '/usr/bin/ffmpeg', | ||
FFProbePath: '/usr/bin/ffprobe' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,40 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node | ||
{ | ||
"build": { "dockerfile": "Dockerfile" }, | ||
"mounts": [ | ||
"source=abs-node-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume" | ||
], | ||
"features": { | ||
"fish": "latest" | ||
"name": "Audiobookshelf", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
// Update 'VARIANT' to pick a Node version: 18, 16, 14. | ||
// Append -bullseye or -buster to pin to an OS version. | ||
// Use -bullseye variants on local arm64/Apple Silicon. | ||
"args": { | ||
"VARIANT": "16" | ||
} | ||
}, | ||
"extensions": [ | ||
"eamodio.gitlens" | ||
] | ||
"mounts": [ | ||
"source=abs-server-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", | ||
"source=abs-client-node_modules,target=${containerWorkspaceFolder}/client/node_modules,type=volume" | ||
], | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [ | ||
3000, | ||
3333 | ||
], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "sh .devcontainer/post-create.sh", | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"dbaeumer.vscode-eslint", | ||
"octref.vetur" | ||
] | ||
} | ||
} | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
# Mark the working directory as safe for use with git | ||
git config --global --add safe.directory $PWD | ||
|
||
# If there is no dev.js file, create it | ||
if [ ! -f dev.js ]; then | ||
cp .devcontainer/dev.js . | ||
fi | ||
|
||
# Update permissions for node_modules folders | ||
# https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-targeted-named-volume | ||
if [ -d node_modules ]; then | ||
sudo chown $(id -u):$(id -g) node_modules | ||
fi | ||
|
||
if [ -d client/node_modules ]; then | ||
sudo chown $(id -u):$(id -g) client/node_modules | ||
fi | ||
|
||
# Install packages for the server | ||
if [ -f package.json ]; then | ||
npm ci | ||
fi | ||
|
||
# Install packages and build the client | ||
if [ -f client/package.json ]; then | ||
(cd client; npm ci; npm run generate) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
|
||
# Declare files that will always have CRLF line endings on checkout. | ||
.devcontainer/post-create.sh text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.env | ||
dev.js | ||
node_modules/ | ||
/dev.js | ||
**/node_modules/ | ||
/config/ | ||
/audiobooks/ | ||
/audiobooks2/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug server", | ||
"runtimeExecutable": "npm", | ||
"args": [ | ||
"run", | ||
"dev" | ||
], | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
] | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug client (nuxt)", | ||
"runtimeExecutable": "npm", | ||
"args": [ | ||
"run", | ||
"dev" | ||
], | ||
"cwd": "${workspaceFolder}/client", | ||
"skipFiles": [ | ||
"${workspaceFolder}/<node_internals>/**" | ||
] | ||
} | ||
], | ||
"compounds": [ | ||
{ | ||
"name": "Debug server and client (nuxt)", | ||
"configurations": [ | ||
"Debug server", | ||
"Debug client (nuxt)" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"path": "client", | ||
"type": "npm", | ||
"script": "generate", | ||
"detail": "nuxt generate", | ||
"label": "Build client", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"dependsOn": [ | ||
"Build client" | ||
], | ||
"type": "npm", | ||
"script": "dev", | ||
"detail": "nodemon --watch server index.js", | ||
"label": "Run server", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"path": "client", | ||
"type": "npm", | ||
"script": "dev", | ||
"detail": "nuxt", | ||
"label": "Run Live-reload client", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": false | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters