-
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathDockerfile.auto
More file actions
73 lines (57 loc) · 1.93 KB
/
Copy pathDockerfile.auto
File metadata and controls
73 lines (57 loc) · 1.93 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Base Stage
FROM ubuntu:22.04 AS base
# Set working directory
WORKDIR /app
# Declare Arguments
ARG SECRET_KEY
ARG RESEND_KEY
ARG POSTGRES_URL
ARG REDIS_URL
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 \
POSTGRES_URL=$POSTGRES_URL \
REDIS_URL=$REDIS_URL \
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 \
curl \
python3.11 \
python3.11-venv \
python3-pip \
git \
&& 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
###################################################################################################################
# Final Stage (Runner)
FROM dependencies AS runner
# Set working directory
WORKDIR /app
# Add a healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://match-roles:8000/health || exit 1
# Run the script with proper error output
CMD ["bash", "-c", "ts-node apps/auto-email-sender/src/index.ts 2>&1 | tee /var/log/auto-email-sender.log"]