-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
43 lines (30 loc) · 921 Bytes
/
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
FROM crystallang/crystal:1.9 AS api-build
WORKDIR /app
# Project shared dependencies
RUN apt update && apt install libsqlite3-dev libevent-dev -y
# Project dependencies API
COPY API/shard.yml API/shard.lock ./
RUN shards install --production
# Copy source code and build
COPY API ./
RUN crystal build --static --release src/main.cr -o journalsApp
FROM node:18-slim as ui-build
WORKDIR /app
# Project dependencies Web-UI
COPY Web-UI/package.json Web-UI/package-lock.json ./
RUN npm ci
# Copy source code and build
COPY Web-UI ./
COPY Web-UI/config.js.example ./config.js
RUN npm run build
FROM nginx:1.25.1-alpine3.17-slim AS runner
# Copy all the build files
COPY --from=api-build /app/journalsApp /app/api/journalsApp
COPY --from=ui-build /app/public /app/ui/public
COPY nginx.conf /etc/nginx/nginx.conf
# Set PORT
EXPOSE 9900
EXPOSE 80
WORKDIR /app
# Start the application
CMD nginx & /app/api/journalsApp