Skip to content

Commit

Permalink
Remove unnecessary copies in dockerfiles (#366)
Browse files Browse the repository at this point in the history
* Remove unnecessary copies in dockerfiles

* Fix the monaco loader

* Make it Prettier
  • Loading branch information
msm-code authored Jan 26, 2024
1 parent 595cd6a commit 3fb3aca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
3 changes: 1 addition & 2 deletions deploy/docker/dev.frontend.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ FROM node:16 AS build
RUN npm install -g serve
COPY src/mqueryfront /app
WORKDIR /app
RUN npm install --legacy-peer-deps && \
cp -r ./node_modules/monaco-editor/min/vs ./public/monaco-vs
RUN npm install --legacy-peer-deps
CMD ["npm", "start"]
4 changes: 1 addition & 3 deletions deploy/docker/web.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ FROM node:16 AS build
RUN npm install -g serve
COPY src/mqueryfront /app
WORKDIR /app
RUN npm install --legacy-peer-deps && \
cp -r ./node_modules/monaco-editor/min/vs ./public/monaco-vs && \
npm run build
RUN npm install --legacy-peer-deps && npm run build

FROM python:3.10

Expand Down
4 changes: 2 additions & 2 deletions src/mqueryfront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.1.16",
"@monaco-editor/react": "3.7.5",
"monaco-editor": "^0.21.2",
"@monaco-editor/react": "^4.4.6",
"monaco-editor": "^0.34.1",
"axios": "^1.3.4",
"bootstrap": "^5.1.3",
"filesize": "^8.0.6",
Expand Down
11 changes: 6 additions & 5 deletions src/mqueryfront/src/query/QueryMonaco.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { Component } from "react";
import Editor, { monaco } from "@monaco-editor/react";
import * as monaco from "monaco-editor/esm/vs/editor/edcore.main";
import Editor, { loader } from "@monaco-editor/react";
import YARA from "./yara-lang";

monaco.config({ paths: { vs: "/monaco-vs" } });
loader.config({ monaco });

class QueryMonaco extends Component {
constructor(props) {
Expand All @@ -17,7 +18,7 @@ class QueryMonaco extends Component {
return;
}

monaco.init().then((monaco) => {
loader.init().then((monaco) => {
this.decorations = this.editor.getModel().deltaDecorations(
[],
[
Expand All @@ -42,7 +43,7 @@ class QueryMonaco extends Component {
handleEditorDidMount(_, editor) {
this.editor = editor;

monaco
loader
.init()
.then((monaco) => {
editor.onDidChangeModelContent((ev) => {
Expand Down Expand Up @@ -122,7 +123,7 @@ class QueryMonaco extends Component {
* Monaco editor initialization
*/

monaco.init().then((monaco) => {
loader.init().then((monaco) => {
// Register a new yara language
monaco.languages.register({ id: "yara" });

Expand Down

0 comments on commit 3fb3aca

Please sign in to comment.