-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.test
More file actions
80 lines (67 loc) · 2.74 KB
/
Dockerfile.test
File metadata and controls
80 lines (67 loc) · 2.74 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
74
75
76
77
78
79
80
ARG CODENAME
FROM registry.drycc.cc/drycc/base:${CODENAME} as build-app
ADD web /web
WORKDIR /web
ENV NODE_VERSION="24"
RUN install-stack node $NODE_VERSION && . init-stack \
&& npm install --global yarn \
&& yarn install \
&& yarn build
ARG CODENAME
FROM registry.drycc.cc/drycc/base:${CODENAME}
ARG DRYCC_UID=1001 \
DRYCC_GID=1001 \
DRYCC_HOME_DIR=/workspace \
PYTHON_VERSION="3.14" \
VALKEY_VERSION="9.0.1" \
POSTGRES_VERSION="18.1" \
GOSU_VERSION="1.19"
RUN groupadd drycc --gid ${DRYCC_GID} \
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR}
ENV PGDATA="/var/lib/postgresql/data"
COPY requirements.txt ${DRYCC_HOME_DIR}/requirements.txt
COPY dev_requirements.txt ${DRYCC_HOME_DIR}/dev_requirements.txt
RUN buildDeps='gcc rustc cargo libffi-dev musl-dev libldap2-dev libsasl2-dev'; \
install-packages ldap-utils mercurial ca-certificates openssl git $buildDeps \
&& curl -SsL https://cli.codecov.io/latest/$([ $(dpkg --print-architecture) == "arm64" ] && echo linux-arm64 || echo linux)/codecov -o /usr/local/bin/codecov \
&& chmod +x /usr/local/bin/codecov \
&& install-stack python $PYTHON_VERSION \
&& install-stack valkey $VALKEY_VERSION \
&& install-stack postgresql $POSTGRES_VERSION \
&& install-stack gosu $GOSU_VERSION && . init-stack \
&& python3 -m venv ${DRYCC_HOME_DIR}/.venv \
&& source ${DRYCC_HOME_DIR}/.venv/bin/activate \
&& pip3 install --disable-pip-version-check --no-cache-dir -r ${DRYCC_HOME_DIR}/requirements.txt \
&& pip3 install --disable-pip-version-check --no-cache-dir -r ${DRYCC_HOME_DIR}/dev_requirements.txt \
# set env
&& echo "source ${DRYCC_HOME_DIR}/.venv/bin/activate" >> /opt/drycc/python/profile.d/python.sh \
# cleanup
&& scanelp ${DRYCC_HOME_DIR}/.venv/lib > runtime.txt \
&& apt-get purge -y --auto-remove $buildDeps \
&& install-packages $(< runtime.txt) \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf \
/usr/share/doc \
/usr/share/man \
/usr/share/info \
/usr/share/locale \
/var/lib/apt/lists/* \
/var/log/* \
/var/cache/debconf/* \
/etc/systemd \
/lib/lsb \
/lib/udev \
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/IBM* \
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/EBC* \
&& mkdir -p /usr/share/man/man{1..8} \
&& mkdir -p /run/postgresql $PGDATA \
&& groupadd postgres && useradd -g postgres postgres \
&& chown -R postgres:postgres /run/postgresql $PGDATA \
&& gosu postgres initdb -D $PGDATA
COPY . ${DRYCC_HOME_DIR}
COPY --chown=${DRYCC_UID}:${DRYCC_GID} . ${DRYCC_HOME_DIR}
COPY --chown=${DRYCC_UID}:${DRYCC_GID} --from=build-app /web/dist ${DRYCC_HOME_DIR}/web/dist
WORKDIR ${DRYCC_HOME_DIR}
CMD ["bin/boot"]
EXPOSE 8000