-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
56 lines (39 loc) · 1.46 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Use a base image with Java and NodeJS installed
FROM eclipse-temurin:18 as build
# Set the working directory for the app
WORKDIR /app
# Move to the frontend directory
WORKDIR /app/frontend
# Copy the frontend source code to the container
COPY ./cogito-front ./
# Install Node.js and npm
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get update && apt-get install -y nodejs
# Install dependencies and build the Angular app
RUN npm ci && npm run build
# Move back to the root directory
WORKDIR /app
# Copy the built Angular app to the backend resources directory
RUN mkdir -p ./backend/src/main/resources/static/
RUN cp -R ./frontend/dist/* ./backend/src/main/resources/static/
WORKDIR /app/backend
# Copy the backend source code to the container
COPY ./cogito-back ./
# Build the backend application
RUN ./mvnw clean install
# Use a new base image for the final app
FROM eclipse-temurin:18
# Set the working directory for the app
WORKDIR /app
# Copy the built backend JAR to the container
COPY --from=build /app/backend/target/*.jar ./
RUN mkdir -p ./image
RUN mkdir -p ./db/cogito
# Expose the port used by the app
EXPOSE 9191
ENV APP_JWT_SECRET=""
ENV API_TWITTER_KEY_SECRET=""
ENV API_TWITTER_KEY=""
ENV HTTPS_ONLY=true
# Start the app
CMD ["java", "-jar", "cogito-1.0.0.jar", "--api.twitter.key=${API_TWITTER_KEY}", "--api.twiter.key.secret=${API_TWITTER_KEY_SECRET}", "--app.jwt.secret=${APP_JWT_SECRET}", "--app.https-only=${HTTPS_ONLY}"]