Skip to content

Commit 09f29d9

Browse files
authored
Move to Ubuntu 24.04 (#23)
* Move to Ubuntu 24.04 * Refactor the docker file for build/run stage * Skip arm for now * Fix up logging in the docker image
1 parent 3b8a533 commit 09f29d9

File tree

4 files changed

+51
-9
lines changed

4 files changed

+51
-9
lines changed

.github/workflows/docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
with:
3939
cache-key: os-capacity
4040
context: .
41-
platforms: linux/amd64,linux/arm64
41+
platforms: linux/amd64
4242
push: true
4343
tags: ${{ steps.image-meta.outputs.tags }}
4444
labels: ${{ steps.image-meta.outputs.labels }}

.github/workflows/tox.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: ['3.10']
11+
python-version: ['3.12']
1212

1313
steps:
1414
- uses: actions/checkout@v4

Dockerfile

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,52 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04 AS build-image
22

3-
RUN apt-get update && apt-get upgrade -y && apt-get install python3-pip tini -y && apt-get clean
3+
RUN apt-get update && \
4+
apt-get upgrade -y && \
5+
apt-get install python3-venv python3-dev gcc git -y && \
6+
rm -rf /var/lib/apt/lists/*
47

5-
COPY ./requirements.txt /opt/os-capacity/requirements.txt
6-
RUN pip install -U -r /opt/os-capacity/requirements.txt
8+
# build into a venv we can copy across
9+
RUN python3 -m venv /opt/venv
10+
ENV PATH="/opt/venv/bin:$PATH"
711

8-
COPY ./os_capacity/prometheus.py /opt/os-capacity/prometheus.py
12+
COPY ./requirements.txt /os-capacity/requirements.txt
13+
RUN pip install -U pip setuptools
14+
RUN pip install --requirement /os-capacity/requirements.txt
15+
16+
COPY . /os-capacity
17+
RUN pip install -U /os-capacity
18+
19+
#
20+
# Now the image we run with
21+
#
22+
FROM ubuntu:24.04 AS run-image
23+
24+
RUN apt-get update && \
25+
apt-get upgrade -y && \
26+
apt-get install --no-install-recommends python3 tini ca-certificates -y && \
27+
rm -rf /var/lib/apt/lists/*
28+
29+
# Copy accross the venv
30+
COPY --from=build-image /opt/venv /opt/venv
31+
ENV PATH="/opt/venv/bin:$PATH"
32+
33+
# Create the user that will be used to run the app
34+
ENV APP_UID=1001
35+
ENV APP_GID=1001
36+
ENV APP_USER=app
37+
ENV APP_GROUP=app
38+
RUN groupadd --gid $APP_GID $APP_GROUP && \
39+
useradd \
40+
--no-create-home \
41+
--no-user-group \
42+
--gid $APP_GID \
43+
--shell /sbin/nologin \
44+
--uid $APP_UID \
45+
$APP_USER
46+
47+
# Don't buffer stdout and stderr as it breaks realtime logging
48+
ENV PYTHONUNBUFFERED=1
49+
50+
USER $APP_UID
951
ENTRYPOINT ["tini", "--"]
10-
CMD ["python3", "-u", "/opt/os-capacity/prometheus.py"]
52+
CMD ["os_capacity"]

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Or just run via docker or similar:::
4646
docker run -d --name os_capacity \
4747
--mount type=bind,source=/etc/kolla/os-capacity/,target=/etc/openstack \
4848
--env OS_CLOUD=openstack --env OS_CLIENT_CONFIG_FILE=/etc/openstack/clouds.yaml \
49-
-p 9000:9000 ghcr.io/stackhpc/os-capacity:e08ecb8
49+
-p 9000:9000 ghcr.io/stackhpc/os-capacity:master
5050
curl localhost:9000
5151

5252

0 commit comments

Comments
 (0)