-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (36 loc) · 1.27 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
## Builder image
FROM python:3.11-slim AS builder
WORKDIR /srv/dareg
# install python packages
COPY ./requirements.txt .
RUN apt update && apt install -y git
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install -r requirements.txt \
&& pip install "oneprovider-client @ git+https://github.com/CERIT-SC/onedata-libs#subdirectory=oneprovider_client" \
&& pip install "onezone-client @ git+https://github.com/CERIT-SC/onedata-libs#subdirectory=onezone_client" \
&& pip install "onepanel-client @ git+https://github.com/CERIT-SC/onedata-libs#subdirectory=onepanel_client" \
&& pip install "onedata_wrapper @ git+https://github.com/CERIT-SC/onedata_core.git@devel"
## Runtime image
FROM python:3.11-slim AS base
WORKDIR /srv/dareg
EXPOSE 8080
# get python packages
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# copy files from repo
COPY ./init.sh /srv/
COPY dareg .
# prepare application
# create user web
RUN useradd -u 1000 -m web -s /bin/bash \
&& chown -R web .
# environment variables
ARG COMMIT_HASH="not_set"
ARG COMMIT_DATE="2000-01-01"
ENV COMMIT_HASH=${COMMIT_HASH}
ENV COMMIT_DATE=${COMMIT_DATE}
USER web
# user-specific
RUN echo "alias pyma='python3 manage.py'" >> ~/.bashrc
CMD [ "/bin/bash", "/srv/init.sh" ]