-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (43 loc) · 1.87 KB
/
Dockerfile
File metadata and controls
58 lines (43 loc) · 1.87 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
FROM python:3.12.13-slim AS build
ENV CRANE_VER=v0.21.2
ENV CRANE_SHA256=897e7c342db072ba76531246fc18fbf3e8e298688b6ecf98916770984b263866
RUN apt-get update && apt-get install -y --no-install-recommends curl git
WORKDIR /craneinstall
# crane install docs: https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md
# Note that the provenance verification step is broken, which wasted an hour or two of time
# https://github.com/google/go-containerregistry/issues/1982
RUN curl -sL https://github.com/google/go-containerregistry/releases/download/$CRANE_VER/go-containerregistry_Linux_x86_64.tar.gz > go-containerregistry.tar.gz \
&& echo "$CRANE_SHA256 go-containerregistry.tar.gz" | sha256sum --check \
&& tar -zxvf go-containerregistry.tar.gz
# Write the git commit for the service
WORKDIR /git
COPY .git /git
RUN GITCOMMIT=$(git rev-parse HEAD) && echo "GIT_COMMIT=\"$GITCOMMIT\"" > /git/git_commit.py
FROM python:3.12.13-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends tini \
&& rm -rf /var/lib/apt/lists/*
# install uv
RUN pip install --upgrade pip && \
pip install uv
# install deps
ARG UV_DEV_ARGUMENT=--no-dev
RUN mkdir /uvinstall
WORKDIR /uvinstall
COPY pyproject.toml uv.lock .python-version .
ENV UV_PROJECT_ENVIRONMENT=/usr/local/
RUN uv sync --locked --inexact $UV_DEV_ARGUMENT
# install the actual code
RUN mkdir /cts
COPY cdmtaskservice /cts/cdmtaskservice
COPY scripts/* /cts
COPY cdmtaskservice_*config.toml.jinja /cts
COPY --from=build /craneinstall/crane /cts
COPY --from=build /git/git_commit.py /cts/cdmtaskservice/
ENV KBCTS_CRANE_PATH=/cts/crane
WORKDIR /cts
# build the code archive
RUN tar -czf cts.tgz --exclude="*/__pycache__*" cdmtaskservice -C /uvinstall .
ENV KBCTS_CODE_ARCHIVE_PATH=/cts/cts.tgz
ENV KBCTS_HTC_EXE_PATH=/cts/cdmtaskservice/condor/run_job.sh
ENTRYPOINT ["tini", "--", "/cts/entrypoint.sh"]