Kaynağa Gözat

Merge branch 'recipe-model-completion' of ssh://gogs.labs/tati/kitchn into recipe-model-completion

Tatiana Inama 6 yıl önce
ebeveyn
işleme
b5600369b8

+ 7 - 0
build/Dockerfile.base

@@ -0,0 +1,7 @@
+FROM node:13.7.0-buster-slim
+RUN echo 'Acquire::http::Proxy "http://proxies.labs:3142/apt-cacher/";' > /etc/apt/apt.conf.d/01proxy
+RUN apt-get update && apt-get install --no-install-recommends -y git openssh-client ca-certificates
+RUN mkdir /root/.ssh/ && chmod 700 /root/.ssh
+ADD key_for_recipes /root/.ssh/id_rsa
+RUN ssh-keyscan -H -p 2222 gogs.davidventura.com.ar  > /root/.ssh/known_hosts
+RUN git clone ssh://git@gogs.davidventura.com.ar:2222/tati/kitchn.git && cd /kitchn && git checkout recipe-model-completion

+ 4 - 0
build/Dockerfile.build

@@ -0,0 +1,4 @@
+FROM ktchn:latest
+RUN cd /kitchn/ktchn && npm install && npm run build
+RUN cd /kitchn/recipes && npm install && npm run build
+ENTRYPOINT /bin/bash

+ 7 - 0
build/build.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+docker build -f Dockerfile.base  . -t ktchn
+docker build -f Dockerfile.build  .  -t ktchn_build
+docker create --name build_output -it ktchn_build
+docker cp build_output:/kitchn/ktchn/dist/bundle.js output/
+docker cp build_output:/kitchn/recipes/build/ output/
+docker rm -f build_output

+ 6 - 2
ktchn/package.json

@@ -5,7 +5,7 @@
   "scripts": {
     "start": "ts-node --inspect-brk=9229 src/server.ts",
     "dev": "node node_modules/nodemon/bin/nodemon.js ts-node --inspect-brk=9229 src/server.ts",
-    "build": "cd node_modules/recipe-ingredient-parser && npm run build && cd ../../ && tsc -p .",
+    "build": "cd node_modules/recipe-ingredient-parser && npm run build && cd ../../ && ./node_modules/.bin/webpack --mode production",
     "build:live": "nodemon --watch 'src/**/*.ts' --exec ts-node src/server.ts"
   },
   "dependencies": {
@@ -43,7 +43,11 @@
     "eslint-config-airbnb-base": "^13.1.0",
     "eslint-plugin-import": "^2.20.1",
     "nodemon": "^1.19.4",
+    "ts-loader": "^6.2.1",
     "ts-node": "^7.0.1",
-    "typescript": "3.7.5"
+    "typescript": "3.7.5",
+    "webpack": "^4.41.5",
+    "webpack-cli": "^3.3.10",
+    "webpack-node-externals": "^1.7.2"
   }
 }

+ 22 - 0
ktchn/webpack.config.js

@@ -0,0 +1,22 @@
+const path = require('path')
+
+module.exports = {
+  entry: './src/server.ts',
+  target: 'node',
+  module: {
+    rules: [
+      {
+        test: /\.tsx?$/,
+        use: 'ts-loader',
+        exclude: /node_modules/,
+      },
+    ],
+  },
+  resolve: {
+    extensions: [ '.tsx', '.ts', '.js' ],
+  },
+  output: {
+    filename: 'bundle.js',
+    path: path.resolve(__dirname, 'dist'),
+  },
+}