-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.cicd
42 lines (33 loc) · 1.14 KB
/
Dockerfile.cicd
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
# Docker image for running CI/CD tests of the backend using JePL
# ================================== BUILDER ===================================
ARG INSTALL_PYTHON_VERSION=3.10
ARG PYTHON_IMAGE_TAG=slim-buster
FROM python:${INSTALL_PYTHON_VERSION}-${PYTHON_IMAGE_TAG} AS backend
# Install system updates and tools
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
postgresql \
libpq-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=dialog
WORKDIR /app
RUN pip install --no-cache tox flake8 bandit
ENV PATH="/home/sid/.local/bin:${PATH}"
ENV FLASK_APP="autoapp.py"
COPY backend backend
COPY autoapp.py ./
COPY requirements requirements
# ============================ Production for CI/CD ============================
FROM backend AS production
ARG USER_ID=1000
ARG USER_GROUP=1000
RUN pip install --no-cache -r requirements/prod.txt
# User ID and GROUP have to match Jenkins CI/CD User!
RUN groupadd -g ${USER_GROUP} sid
RUN useradd -u ${USER_ID} -g ${USER_GROUP} -m sid
RUN chown -R sid:sid /app
USER sid
ENV FLASK_ENV="production"
EXPOSE 5000
CMD ["tail","-f","/dev/null"]