-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
108 lines (90 loc) · 3.17 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
ARG VERSION=dev
FROM ubuntu:jammy as build
MAINTAINER Luis Héctor Chávez <[email protected]>
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git \
python3-pip \
python3.10-venv \
&& \
rm -rf /var/lib/apt/lists/*
# Python support.
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install \
build \
setuptools
ARG VERSION $VERSION
ADD ./ /hook_tools
RUN if [ "${VERSION}" = "dev" ]; then \
cd /hook_tools && \
python3 -m build; \
else \
mkdir /hook_tools/dist/ && \
touch /hook_tools/dist/empty.whl; \
fi
FROM ubuntu:jammy
MAINTAINER Luis Héctor Chávez <[email protected]>
RUN ln -snf /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
echo Etc/UTC > /etc/timezone && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
clang-format \
curl \
git \
locales \
php8.1-cli \
php8.1-mbstring \
php8.1-xml \
php8.1-zip \
python3-pip \
python3.10-venv \
unzip && \
rm -rf /var/lib/apt/lists/* && \
/usr/sbin/locale-gen en_US.UTF-8 && \
/usr/sbin/update-locale LANG=en_US.UTF-8
# Python support.
ADD requirements.txt requirements.test.txt ./
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install -r requirements.txt -r requirements.test.txt && \
mkdir -p /.pylint.d && chown 1000:1000 /.pylint.d
# JavaScript support.
RUN git clone https://github.com/creationix/nvm.git /nvm --branch=v0.38.0 && \
(. /nvm/nvm.sh && nvm install v14.17.3 ; nvm use --delete-prefix v14.17.3)
ENV PATH="/usr/bin/versions/node/v14.17.3/bin:${PATH}"
RUN npm install -g yarn && \
yarn global add \
@typescript-eslint/[email protected] \
@typescript-eslint/[email protected] \
RUN useradd --uid 1000 --create-home ubuntu && \
mkdir -p /.yarn /.cache && chown ubuntu:ubuntu /.yarn /.cache && \
mkdir -p /src /hook_tools
# PHP support.
RUN curl -sL https://getcomposer.org/download/2.1.14/composer.phar -o /usr/bin/composer && \
chmod +x /usr/bin/composer
ENV PATH="/src/vendor/bin:/hook_tools/vendor/bin:${PATH}"
WORKDIR /src
ENV DOCKER=true
ENV LANG=en_US.UTF-8
COPY --from=build /hook_tools/dist/*.whl /tmp/
ARG VERSION $VERSION
RUN if [ "${VERSION}" = "dev" ]; then \
python3 -m pip install /tmp/*.whl && rm /tmp/*.whl; \
else \
python3 -m pip install "omegaup-hook-tools==$(echo "${VERSION}" | sed -e 's/^v//')"; \
fi
ADD ./ /hook_tools
RUN (cd /hook_tools && composer install)
# Allow non-Linux machines to use `git` everywhere in the filesystem, since all
# the virtualization techniques will cause the filesystems to be mounted with
# unexpected permissions that make git bail out.
RUN printf '[safe]\n\tdirectory = *\n' >> /etc/gitconfig
USER ubuntu
ENTRYPOINT ["python3", "-m", "omegaup_hook_tools"]