-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
120 lines (95 loc) · 2.98 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# ---
# Build arguments
# ---
ARG DOCKER_PARENT_IMAGE
FROM $DOCKER_PARENT_IMAGE
# NB: Arguments should come after FROM otherwise they're deleted
ARG BUILD_DATE
# Silence debconf
ARG DEBIAN_FRONTEND=noninteractive
# Add vscode user to the container
ARG PROJECT_NAME
ARG PYTHON_VERSION
# ---
# Enviroment variables
# ---
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8
ENV TZ Australia/Sydney
SHELL ["/bin/bash", "-c"]
ENV SHELL=/bin/bash
ENV PROJECT_NAME=$PROJECT_NAME
ENV HOME=/home/$PROJECT_NAME
ENV PYTHON_VERSION=$PYTHON_VERSION
ENV PYTHONPATH=$HOME
# Set container time zone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
LABEL org.label-schema.build-date=$BUILD_DATE \
maintainer="[email protected]"
# Create the "home" folder
RUN mkdir -p $HOME
COPY . $HOME
WORKDIR $HOME
# ---
# Install pyenv
#
# References:
# [1] https://stackoverflow.com/questions/65768775/how-do-i-integrate-pyenv-poetry-and-docker
# ---
# Install pyenv dependencies
RUN apt-get update && \
apt-get install -y build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git && \
apt-get clean
RUN git clone --depth=1 https://github.com/pyenv/pyenv.git $HOME/.pyenv
ENV PYENV_ROOT="${HOME}/.pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
# ---
# Install Python and set the correct version
# ---
RUN pyenv install $PYTHON_VERSION && pyenv global $PYTHON_VERSION
# ---
# Install NodeJS
# ---
RUN curl -fsSL https://deb.nodesource.com/setup_21.x | bash -
RUN apt-get update && \
apt-get install -y nodejs
# ---
# Uncomment this Section to Install Additional Debian Packages
# ---
# COPY debian-requirements.txt /usr/local/debian-requirements.txt
# RUN apt-get update && \
# DEBIAN_PACKAGES=$(egrep -v "^\s*(#|$)" /usr/local/debian-requirements.txt) && \
# apt-get install -y $DEBIAN_PACKAGES && \
# apt-get clean
# ---
# Copy Container Setup Scripts
# ---
# COPY pyproject.toml /usr/local/pyproject.toml
# COPY poetry.lock /usr/local/poetry.lock # Uncomment this line to include poetry.lock
# Get poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="${PATH}:$HOME/.poetry/bin"
ENV PATH="${PATH}:$HOME/.local/bin"
RUN poetry config virtualenvs.create false
# && cd /usr/local \
# && poetry install --no-interaction --no-ansi
ENV PATH="${PATH}:$HOME/.local/bin"
# Need for Pytest
ENV PATH="${PATH}:${PYENV_ROOT}/versions/$PYTHON_VERSION/bin"
# ---
# Install Quartz
# ---
RUN cd /usr/local \
&& git clone https://github.com/jackyzha0/quartz.git \
&& cd quartz \
&& npm i
# && npx quartz create
# RUN cp -r $HOME/.config/quartz/* /usr/local/quartz
# RUN mkdir -p /usr/local/quartz/content && \
# ln -s $HOME/* /usr/local/quartz/content
RUN cd /usr/local/quartz && \
git remote rm origin && \
git remote add origin [email protected]:hsteinshiromoto/ml.md.git
# RUN npx quartz sync --no-pull