Dockerfile 1.44 KB
Newer Older
BO ZHANG's avatar
BO ZHANG committed
1
2
# base image
ARG HARBOR
BO ZHANG's avatar
BO ZHANG committed
3
FROM ${HARBOR}/csst/miniconda3-py312:latest
BO ZHANG's avatar
BO ZHANG committed
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
# declare variables
ARG PIPELINE_ID
ARG BUILD
ARG CREATED
# set environment variables
ENV PIPELINE_ID=${PIPELINE_ID} \
    BUILD=${BUILD} \
    CREATED=${CREATED}
# label info
LABEL MAINTAINER="Bo Zhang <bozhang@nao.cas.cn>"
LABEL PIPELINE_ID=${PIPELINE_ID}
LABEL BUILD=${BUILD}
LABEL CREATED=${CREATED}

# run as root
USER root
# install system softwares
RUN --mount=type=cache,id=apt,target=/var/cache/apt \
    apt-get update && apt-get install -y \
    git \
    && rm -rf /var/lib/apt/lists/*

# run as csst
USER csst
# copy VCS roots into image
COPY --chown=csst:csst . /pipeline
BO ZHANG's avatar
BO ZHANG committed
30
RUN mv pkg/csst-dag/app /pipeline/app \
BO ZHANG's avatar
BO ZHANG committed
31
    && chmod +x /pipeline/app/csst
BO ZHANG's avatar
BO ZHANG committed
32
33
# install packages & requirements
RUN --mount=type=cache,id=pip,uid=9000,gid=9000,target=/home/csst/.cache \
BO ZHANG's avatar
BO ZHANG committed
34
35
36
37
38
39
    pip install pkg/ccds \
    && pip install pkg/csst-dfs-client \
    && pip install pkg/csst_common \
    && pip install pkg/csst_dadel \
    && pip install pkg/csst-dag \
    && pip install -r requirements.txt \
BO ZHANG's avatar
tweaks    
BO ZHANG committed
40
    && rm -rf pkg
BO ZHANG's avatar
BO ZHANG committed
41
42
# change workdir
WORKDIR /pipeline/output
BO ZHANG's avatar
BO ZHANG committed
43
RUN touch /pipeline/output/pipeline.log
BO ZHANG's avatar
BO ZHANG committed
44
45
46
47

# 设置容器启动时默认执行的命令(这里以提供一个帮助信息为例)
# 实际使用时,你可能会通过docker run覆盖这个命令来调用具体的工具
CMD ["python", "-c", "import csst_dag; print('csst_dag is available. Use docker run <image> <command> to execute specific functions.')"]