File size: 1,688 Bytes
b7c98e5
318bea8
 
 
 
 
 
 
589cabc
318bea8
589cabc
 
318bea8
 
 
589cabc
318bea8
 
efe760e
 
 
 
 
 
 
 
3644be3
 
318bea8
589cabc
20a6f1a
589cabc
 
 
 
 
 
 
 
 
 
318bea8
2a26669
318bea8
 
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
FROM python:3.13

RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*

RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# pull requirements.txt
WORKDIR /app
COPY --chown=user ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Set ENV Vars
RUN --mount=type=secret,id=SUPABASE_URL,mode=0444 \
  export SUPABASE_URL=$(cat /run/secrets/SUPABASE_URL)
RUN --mount=type=secret,id=SUPABASE_SERVICE_KEY,mode=0444 \
  export SUPABASE_SERVICE_KEY=$(cat /run/secrets/SUPABASE_SERVICE_KEY)
RUN --mount=type=secret,id=DB_HOST,mode=0444 \
  export DB_HOST=$(cat /run/secrets/DB_HOST)
RUN --mount=type=secret,id=DB_USER,mode=0444 \
  export DB_USER=$(cat /run/secrets/DB_USER)
RUN --mount=type=secret,id=DB_PASS,mode=0444 \
  export DB_PASS=$(cat /run/secrets/DB_PASS)
RUN --mount=type=secret,id=DB_NAME,mode=0444 \
  export DB_NAME=$(cat /run/secrets/DB_NAME)
RUN --mount=type=secret,id=ENVIRONMENT,mode=0444 \
  export ENVIRONMENT=$(cat /run/secrets/ENVIRONMENT)

# Use the access token to secretly pull the repo
ARG CACHEBUST=1
WORKDIR /app
RUN --mount=type=secret,id=GITLAB_ACCESS_TOKEN,mode=0444,required=true \
  echo "Current time: $(date +%Y-%m-%dT%H:%M:%S%z)" && \
  git clone -b dev --depth 1 https://nevronline:$(cat /run/secrets/GITLAB_ACCESS_TOKEN)@gitlab.com/nevronline/interstate.git 
# Move to project dir
WORKDIR /app/interstate
RUN git log -n 1
RUN mv /app/interstate/* /app
RUN ls -a /app/interstate
RUN rm -rf /app/interstate

WORKDIR /app
COPY --chown=user . /app/interstate
CMD gunicorn -w 1 -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -b 0.0.0.0:7860 'app:app'