Skip to content

Commit

Permalink
Setup Docker with updated dependencies and domains (#1)
Browse files Browse the repository at this point in the history
- Adds `chat.blender.org` and `chat.staging.blender.org` to
`trustedWebInstances`
- Update `caniuse` and move `devDependencies` to `dependencies`
- Replace deprecated use of `fs.rmdir()` with `fs.rm()`
- Create `Dockerfile` that has a build staging using `yarn` and serves
the static build using `nginx-unprivileged`
  • Loading branch information
bartvdbraak authored Aug 22, 2024
1 parent a51e28e commit 0953863
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Stage 1: Build the application
FROM node:20-alpine as builder
WORKDIR /app
COPY . ./
ENV NODE_ENV=production
RUN yarn install --frozen-lockfile && yarn run build

# Stage 2: Serve the application with unprivileged NGINX
FROM nginxinc/nginx-unprivileged as production

ARG DOCROOT=/usr/share/nginx/html
COPY --from=builder /app/build ${DOCROOT}

EXPOSE 8080
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"start": "node scripts/serve-local.js",
"build": "node scripts/build.js"
},
"devDependencies": {
"dependencies": {
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
"@rollup/plugin-babel": "^5.1.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async function buildCss(entryPath, targetDir, assets) {

async function removeDirIfExists(targetDir) {
try {
await fs.rmdir(targetDir, {recursive: true});
await fs.rm(targetDir, { recursive: true });
} catch (err) {
if (err.code !== "ENOENT") {
throw err;
Expand Down
2 changes: 2 additions & 0 deletions src/open/clients/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import {Maturity, Platform, LinkKind,
FDroidLink, AppleStoreLink, PlayStoreLink, WebsiteLink} from "../types.js";

const trustedWebInstances = [
"chat.blender.org",
"chat.staging.blender.org",
"app.element.io", // first one is the default one
"develop.element.io",
"chat.fedoraproject.org",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,9 @@ call-bind@^1.0.0:
get-intrinsic "^1.0.0"

caniuse-lite@^1.0.30001165, caniuse-lite@^1.0.30001219:
version "1.0.30001230"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001230.tgz#8135c57459854b2240b57a4a6786044bdc5a9f71"
integrity sha512-5yBd5nWCBS+jWKTcHOzXwo5xzcj4ePE/yjtkZyUV1BTUmrBaA9MRGC+e7mxnqXSA90CmCA8L3eKLaSUkt099IQ==
version "1.0.30001651"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz"
integrity sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==

chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2:
version "2.4.2"
Expand Down

0 comments on commit 0953863

Please sign in to comment.