Fixed Dockerfile with cubetiq user and fixed import in routes wrong path
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -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
|
||||
|
||||
# Stop running as root at this point
|
||||
RUN useradd -m myuser
|
||||
RUN useradd -m cubetiq
|
||||
WORKDIR /usr/src/app/
|
||||
RUN chown myuser:myuser /usr/src/app/
|
||||
USER myuser
|
||||
RUN chown cubetiq:cubetiq /usr/src/app/
|
||||
USER cubetiq
|
||||
|
||||
# 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
|
||||
|
||||
# Copy all needed project files to a folder
|
||||
COPY --chown=myuser:myuser src src
|
||||
COPY --chown=myuser:myuser frontend frontend
|
||||
COPY --chown=myuser:myuser package.json ./
|
||||
COPY --chown=cubetiq:cubetiq src src
|
||||
COPY --chown=cubetiq:cubetiq frontend frontend
|
||||
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
|
||||
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
|
||||
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
|
||||
FROM openjdk:16-jdk-slim
|
||||
COPY --from=build /usr/src/app/target/*.jar /usr/app/app.jar
|
||||
RUN useradd -m myuser
|
||||
USER myuser
|
||||
RUN useradd -m cubetiq
|
||||
USER cubetiq
|
||||
EXPOSE 8080
|
||||
CMD java -jar /usr/app/app.jar
|
||||
|
||||
Reference in New Issue
Block a user