-
-
Notifications
You must be signed in to change notification settings - Fork 103
/
Dockerfile.auto
90 lines (71 loc) · 2.37 KB
/
Dockerfile.auto
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Base Stage
FROM ubuntu:22.04 AS base
# Set working directory
WORKDIR /app
# Declare Arguments
ARG SECRET_KEY
ARG RESEND_KEY
ARG SUPABASE_URL
ARG SUPABASE_SERVICE_ROLE
ARG MONGO_ADDRESS
ARG MONGO_PASSWORD
ARG MONGO_USERNAME
ARG RABBITMQ_ADDRESS
# Convert build-time variables to environment variables
ENV SECRET_KEY=$SECRET_KEY \
RESEND_KEY=$RESEND_KEY \
SUPABASE_URL=$SUPABASE_URL \
SUPABASE_SERVICE_ROLE=$SUPABASE_SERVICE_ROLE \
MONGO_ADDRESS=$MONGO_ADDRESS \
MONGO_PASSWORD=$MONGO_PASSWORD \
MONGO_USERNAME=$MONGO_USERNAME \
RABBITMQ_ADDRESS=$RABBITMQ_ADDRESS
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
gfortran \
libopenblas-dev \
cmake \
liblapack-dev \
libffi-dev \
git \
curl \
python3.11 \
python3.11-venv \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js and npm
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs
# Install TurboRepo and ts-node globally
RUN npm install -g turbo ts-node
###################################################################################################################
# Dependencies Stage
FROM base AS dependencies
# Set working directory
WORKDIR /app
# Copy the specific project files
COPY apps/auto-email-sender ./apps/auto-email-sender
COPY packages ./packages
COPY package*.json turbo.json yarn.lock ./
# Install monorepo dependencies and scoped project dependencies in one step
RUN npm install && npm install --prefix apps/auto-email-sender
###################################################################################################################
# Builder Stage
FROM dependencies AS builder
# Setup match_roles and prepare Python environment
WORKDIR /app/apps/auto-email-sender/src/match_roles
RUN python3.11 -m venv matchenv && \
. matchenv/bin/activate && \
pip install --upgrade pip setuptools wheel cython pybind11 pythran && \
pip install numpy && \
pip install -r requirements.txt
###################################################################################################################
# Final Stage (Runner)
FROM base AS runner
# Set working directory
WORKDIR /app
# Copy the build output and node_modules from the builder stage
COPY --from=builder /app /app
# Run the script
CMD ["ts-node", "apps/auto-email-sender/src/index.ts"]