Fixed Dockerfile with cubetiq user and fixed import in routes wrong path

This commit is contained in:
Sambo Chea 2021-07-25 18:16:45 +07:00
parent 6e3f448aa3
commit 814a0cc391
6 changed files with 455 additions and 394 deletions

View File

@ -4,23 +4,22 @@ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get update -qq && apt-get install -qq --no-install-recommends nodejs RUN apt-get update -qq && apt-get install -qq --no-install-recommends nodejs
# Stop running as root at this point # Stop running as root at this point
RUN useradd -m myuser RUN useradd -m cubetiq
WORKDIR /usr/src/app/ WORKDIR /usr/src/app/
RUN chown myuser:myuser /usr/src/app/ RUN chown cubetiq:cubetiq /usr/src/app/
USER myuser USER cubetiq
# Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies # Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies
COPY --chown=myuser pom.xml ./ COPY --chown=cubetiq pom.xml ./
RUN mvn dependency:go-offline -Pproduction RUN mvn dependency:go-offline -Pproduction
# Copy all needed project files to a folder # Copy all needed project files to a folder
COPY --chown=myuser:myuser src src COPY --chown=cubetiq:cubetiq src src
COPY --chown=myuser:myuser frontend frontend COPY --chown=cubetiq:cubetiq frontend frontend
COPY --chown=myuser:myuser package.json ./ COPY --chown=cubetiq:cubetiq package.json ./
# Using * after the files that are autogenerated so that so build won't fail if they are not yet created # Using * after the files that are autogenerated so that so build won't fail if they are not yet created
COPY --chown=myuser:myuser package-lock.json* pnpm-lock.yaml* webpack.config.js* ./ COPY --chown=cubetiq:cubetiq package-lock.json* pnpm-lock.yaml* webpack.config.js* ./
# Build the production package, assuming that we validated the version before so no need for running tests again # Build the production package, assuming that we validated the version before so no need for running tests again
RUN mvn clean package -DskipTests -Pproduction RUN mvn clean package -DskipTests -Pproduction
@ -28,7 +27,7 @@ RUN mvn clean package -DskipTests -Pproduction
# Running stage: the part that is used for running the application # Running stage: the part that is used for running the application
FROM openjdk:16-jdk-slim FROM openjdk:16-jdk-slim
COPY --from=build /usr/src/app/target/*.jar /usr/app/app.jar COPY --from=build /usr/src/app/target/*.jar /usr/app/app.jar
RUN useradd -m myuser RUN useradd -m cubetiq
USER myuser USER cubetiq
EXPOSE 8080 EXPOSE 8080
CMD java -jar /usr/app/app.jar CMD java -jar /usr/app/app.jar

View File

@ -1,5 +1,5 @@
import { Route } from '@vaadin/router'; import { Route } from '@vaadin/router';
import Role from './generated/com/example/application/data/Role'; import Role from './generated/com/cubetiqs/fusion/data/Role';
import { appStore } from './stores/app-store'; import { appStore } from './stores/app-store';
import './views/home/home-view'; import './views/home/home-view';
import './views/main-layout'; import './views/main-layout';

0
mvnw vendored Normal file → Executable file
View File

View File

@ -166,6 +166,6 @@
"workbox-precaching": "6.1.0", "workbox-precaching": "6.1.0",
"workbox-webpack-plugin": "6.1.0" "workbox-webpack-plugin": "6.1.0"
}, },
"hash": "732bab371dec73c0c97e8b97b815095666d7d1f3c5c61b169d46ba69f09ab1a6" "hash": "9ddb4f6e8962f3cde8464b04b7a779f57b828396463f8fc6d8f7405edf5e361b"
} }
} }

File diff suppressed because it is too large Load Diff

32
webpack.config.js Normal file
View File

@ -0,0 +1,32 @@
/**
* This file contains project specific customizations for the webpack build.
* It is autogenerated if it didn't exist or if it was made for an older
* incompatible version.
*
* Defaults are provided in an autogenerated webpack.generated.js file and used by this file.
* The webpack.generated.js file is overwritten on each build and no customization can be done there.
*/
const merge = require('webpack-merge');
const flowDefaults = require('./webpack.generated.js');
/**
* To change the webpack config, add a new configuration object in
* the merge arguments below:
*/
module.exports = merge(flowDefaults,
// Override default configuration
// {
// mode: 'development',
// devtool: 'inline-source-map',
// },
// Add a custom plugin
// (install the plugin with `npm install --save-dev webpack-bundle-analyzer`)
// {
// plugins: [
// new require('webpack-bundle-analyzer').BundleAnalyzerPlugin({
// analyzerMode: 'static'
// })
// ]
// },
);