This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
forked from codecov/codecov-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.enterprise
85 lines (69 loc) · 2.47 KB
/
Dockerfile.enterprise
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
FROM codecov/api:latest as build
# Pyinstaller necessities
# PyInstaller needs zlib-dev, gcc, libc-dev, and musl-dev
RUN apk --update --no-cache add \
zlib-dev \
musl-dev \
libc-dev \
libffi-dev \
gcc \
g++ \
git \
pwgen \
&& pip install --upgrade pip
RUN pip install pyinstaller==4.7
RUN pip uninstall -y typing
# install cython
RUN pip install cython==3.0a9
RUN pip install tinyaes
# set settings module
ENV DJANGO_SETTINGS_MODULE "codecov.settings_enterprise"
# Remove the settings dev and enterprise files.
# These should *never* make it to enterprise.
RUN rm /app/codecov/settings_dev.py
RUN rm /app/codecov/settings_prod.py
RUN rm /app/codecov/settings_test.py
RUN rm /app/codecov/settings_staging.py
# Remove unneeded folders
RUN rm -rf /app/.github
RUN rm -rf /app/.circleci
# Remove and rewrite the settings module to the
# enterprise variant. This removes all reference to
# dev and prod settings.
RUN rm /app/utils/config.py
COPY enterprise/config.py /app/utils/config.py
# execute Cython script in app dir
COPY enterprise/ldd /pyinstaller/ldd
COPY enterprise/setup.py setup.py
COPY enterprise/cythonize.sh /pyinstaller/cythonize_everything.sh
COPY enterprise/pyi_rth_django.py /pyinstaller/pyi_rth_django.py
COPY enterprise/generate_pyinstaller_args.py /pyinstaller/generate_pyinstaller_args.py
#Copy Hooks
COPY enterprise/hooks /hooks
# Not the cleanest, but this helps with layer caching.
RUN chmod a+x /pyinstaller/*
RUN ["/pyinstaller/cythonize_everything.sh"]
COPY enterprise/package.sh /pyinstaller/package.sh
RUN chmod a+x /pyinstaller/*
RUN ["/pyinstaller/package.sh"]
ENV RUN_ENV=ENTERPRISE
# Create the codecov user to run the container as
RUN addgroup -S application && adduser -S codecov -G application
RUN mkdir -p /config && chown codecov:application /config
# copy the enterprise settings module.
WORKDIR /home
COPY ./enterprise.sh /home/enterprise.sh
RUN chown codecov:application /home/enterprise.sh && \
chmod +x /home/enterprise.sh && \
chown codecov:application /home/api
FROM alpine:3.16
RUN addgroup -S application && adduser -S codecov -G application && rm -rf /home/codecov
USER codecov
COPY --from=build /home/enterprise.sh /home/enterprise
COPY --from=build /home/api /home/api
ARG RELEASE_VERSION
ENV RELEASE_VERSION $RELEASE_VERSION
ENV DJANGO_SETTINGS_MODULE "codecov.settings_enterprise"
ENV CODECOV_API_PORT=8000
WORKDIR /home
ENTRYPOINT ["./enterprise"]