-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (30 loc) · 1 KB
/
Dockerfile
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 docker.io/rockylinux:9 AS appbuilder
ENV HOME="/root"
ENV PYENV_ROOT="${HOME}/.pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${HOME}/.local/bin:${PATH}"
COPY . /tmp/app
WORKDIR /tmp/app
RUN mkdir -p "${HOME}/.local/bin" && bash ./bin/deploy.sh
FROM docker.io/rockylinux:9 AS main
ARG USERNAME=devu
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG WORK_DIR=/workspace
ENV HOME="/home/${USERNAME}"
COPY . /tmp/app
WORKDIR /tmp/app
COPY --from=appbuilder /tmp/build /tmp/build
COPY --from=appbuilder /health.sh /health.sh
COPY --from=appbuilder /entrypoint.sh /entrypoint.sh
RUN bash ./bin/deploy/init_py.sh
WORKDIR /
RUN rm -rf /tmp/app
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -m -d $HOME \
--uid $USER_UID --gid $USER_GID $USERNAME
RUN mkdir -p $WORK_DIR && \
chown $USERNAME:$USERNAME -R $WORK_DIR && \
mkdir -p "${HOME}/.local/bin" && \
chown $USERNAME:$USERNAME -R $HOME
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
HEALTHCHECK --interval=5m --timeout=3s CMD /health.sh