-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (44 loc) · 2 KB
/
Dockerfile
File metadata and controls
59 lines (44 loc) · 2 KB
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
57
58
59
#################################################################
# Stage 1: Base environment for both development and production
#################################################################
# pull latest julia image
FROM julia:latest AS base
# Set working direction to api
WORKDIR /api
# Install asyncapi generator (html generator for documentation) and dependencies
RUN apt-get update && \
apt-get install -y curl gnupg git && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs && \
npm install -g @asyncapi/cli
# Generate the HTML documentation during the build
COPY docs /api/docs
RUN asyncapi generate fromTemplate /api/docs/asyncapi.yaml @asyncapi/html-template@3.0.0 --use-new-generator -o docs/build
# Setting up the project environment
COPY dependencies.jl /api/dependencies.jl
RUN julia --project=. /api/dependencies.jl
#################################################################
# Stage 2: Development stage
#################################################################
FROM base AS dev
# RUN julia --project=. -e "using Pkg; Pkg.activate(\".\"); Pkg.instantiate(); Pkg.precompile();"
# Copy the remaining needed scripts to the docker image
COPY api.jl .
COPY scripts /api/scripts
RUN mkdir input_files
RUN mkdir results
#################################################################
# Stage 3: Production stage
#################################################################
FROM base AS prod
# Update the linux system and install the compiler needed to create the pre-compilation system image
RUN apt-get update && apt-get install -y g++
# Copy the remaining needed scripts to the docker image
COPY pre-compilation /api/pre-compilation
COPY logs logs
COPY api.jl .
COPY scripts /api/scripts
RUN mkdir input_files
RUN mkdir results
# pre-compilation of the api (Comment out this line during development as it will rebuild every time you change something in api.jl or the 'scripts' folder.)
RUN julia --project=. /api/pre-compilation/buildSysImage.jl