Skip to content

Commit a5388e3

Browse files
committed
Appy new universal build foundation
1 parent 240f290 commit a5388e3

File tree

5 files changed

+62
-312
lines changed

5 files changed

+62
-312
lines changed
Lines changed: 1 addition & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1 @@
1-
FROM ubuntu:20.04
2-
3-
# Fix for pipe operations: https://github.com/hadolint/hadolint/wiki/DL4006
4-
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
5-
6-
# Generate and Set locals
7-
# https://stackoverflow.com/questions/28405902/how-to-set-the-locale-inside-a-debian-ubuntu-docker-container#38553499
8-
RUN apt-get update \
9-
&& apt-get install -y --no-install-recommends locales \
10-
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
11-
&& locale-gen \
12-
&& dpkg-reconfigure --frontend=noninteractive locales \
13-
&& update-locale LANG=en_US.UTF-8 \
14-
# Clean up
15-
&& apt-get clean \
16-
&& rm -rf /var/lib/apt/lists/*
17-
18-
ENV LC_ALL="en_US.UTF-8" \
19-
LANG="en_US.UTF-8" \
20-
LANGUAGE="en_US:en" \
21-
TZ="Europe/Berlin" \
22-
DEBIAN_FRONTEND="noninteractive" \
23-
RESOURCES_PATH="/resources"
24-
25-
# Create resources folder
26-
RUN mkdir $RESOURCES_PATH && chmod a+rwx $RESOURCES_PATH
27-
28-
# Install basics
29-
# hadolint ignore=DL3005
30-
RUN apt-get update --fix-missing \
31-
&& apt-get install -y --no-install-recommends apt-utils \
32-
&& apt-get -y upgrade \
33-
&& apt-get update \
34-
&& apt-get install -y --no-install-recommends \
35-
apt-transport-https \
36-
ca-certificates \
37-
curl \
38-
wget \
39-
gnupg2 \
40-
git \
41-
jq \
42-
software-properties-common \
43-
# Required by Pyenv
44-
make \
45-
build-essential \
46-
libbz2-dev \
47-
libssl-dev \
48-
libreadline-dev \
49-
libsqlite3-dev \
50-
libffi-dev \
51-
# Clean up
52-
&& apt-get clean \
53-
&& rm -rf /var/lib/apt/lists/*
54-
55-
# Add tini
56-
RUN curl -fsSL https://github.com/krallin/tini/releases/download/v0.19.0/tini -o /tini && \
57-
chmod +x /tini
58-
59-
# Install Docker in Container
60-
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
61-
&& add-apt-repository \
62-
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
63-
$(lsb_release -cs) \
64-
stable" \
65-
&& apt-get update -y \
66-
&& apt-get install -y --no-install-recommends docker-ce=5:19.03.13~3-0~ubuntu-focal \
67-
# Clean up
68-
&& apt-get clean \
69-
&& rm -rf /var/lib/apt/lists/*
70-
71-
# Install Python
72-
RUN apt-get update \
73-
&& apt-get install -y --no-install-recommends \
74-
python3 \
75-
python3-pip \
76-
gcc \
77-
python3-dev \
78-
&& ln -s /usr/bin/python3 /usr/bin/python \
79-
&& ln -s /usr/bin/pip3 /usr/bin/pip \
80-
&& pip install \
81-
setuptools==50.* \
82-
wheel==0.* \
83-
flake8==3.* \
84-
pytest==6.* \
85-
twine==3.* \
86-
mypy==0.* \
87-
pytest-cov==2.* \
88-
black==20.8b1 \
89-
pydocstyle==5.* \
90-
isort==5.* \
91-
docker==4.* \
92-
nox==2020.8.* \
93-
pipenv==2020.11.* \
94-
# Clean up
95-
&& apt-get clean \
96-
&& rm -rf /var/lib/apt/lists/*
97-
98-
# Install pyenv to allow dynamic creation of python versions
99-
RUN git clone https://github.com/pyenv/pyenv.git $RESOURCES_PATH/.pyenv
100-
# Add pyenv to path
101-
ENV PATH=$RESOURCES_PATH/.pyenv/shims:$RESOURCES_PATH/.pyenv/bin:$PATH \
102-
PYENV_ROOT=$RESOURCES_PATH/.pyenv
103-
104-
# Install web development tools
105-
RUN apt-get update \
106-
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
107-
&& apt-get install -y --no-install-recommends nodejs \
108-
&& npm install -g yarn@1 \
109-
# Clean up
110-
&& apt-get clean \
111-
&& rm -rf /var/lib/apt/lists/*
112-
113-
# Install markdown lint tool
114-
RUN npm install -g markdownlint@^0.21.1 markdownlint-cli@^0.24.0
115-
116-
# Workaround to get ssh working in act and github actions
117-
RUN mkdir -p /github/home/.ssh/ \
118-
# create empty config file if not exists
119-
&& touch /github/home/.ssh/config \
120-
&& chown -R root:root /github/home/.ssh \
121-
&& chmod 700 /github/home/.ssh \
122-
&& ln -s /github/home/.ssh /root/.ssh
123-
124-
# Settings and configurations
125-
ENV \
126-
# Use local folder as pipenv virtualenv
127-
PIPENV_VENV_IN_PROJECT=true \
128-
# Flush log message immediately to stdout
129-
PYTHONUNBUFFERED=true
130-
131-
132-
# Install Universal-Build
133-
# hadolint ignore=DL3013
134-
RUN pip install git+https://github.com/ml-tooling/universal-build.git
135-
136-
COPY entrypoint.sh /entrypoint.sh
137-
138-
RUN chmod +x /entrypoint.sh
139-
140-
ENTRYPOINT ["/tini", "-g", "--", "/entrypoint.sh"]
1+
FROM mltooling/build-environment:0.1.9

.github/actions/build-environment/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "build-environment"
2-
description: "Environment to run build, test, and release steps."
2+
description: "Environment to run build, test, check, and release steps."
33
author: "ML Tooling <[email protected]>"
44
inputs:
55
build_args:

.github/actions/build-environment/entrypoint.sh

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/release-pipeline.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ jobs:
9494
# only works if it exist: pr_milestone: v${{ env.VERSION }}
9595
github_token: ${{ secrets.GITHUB_TOKEN }}
9696
# Fix of release drafter to allow different events to trigger the release
97-
- name: checkout-fixed-release-drafter
97+
- if: ${{ env.GITHUB_TOKEN }}
98+
name: checkout-fixed-release-drafter
9899
uses: actions/checkout@v2
99100
with:
100101
repository: ml-tooling/release-drafter

0 commit comments

Comments
 (0)