-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (57 loc) · 2.05 KB
/
Copy pathDockerfile
File metadata and controls
65 lines (57 loc) · 2.05 KB
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
FROM registry.access.redhat.com/ubi10@sha256:be840bb76e74900d39d5e4620c184e89382dcfce09cb05c98b4e1246d55612a5 AS ubi
FROM mirror.gcr.io/library/golang:1.26.4-alpine AS golang
FROM mirror.gcr.io/library/node:24.17-bookworm-slim AS node
FROM mirror.gcr.io/library/rust:1.93.1-slim-bookworm AS rust
########################
# PREPARE OUR BASE IMAGE
########################
FROM ubi AS base
RUN dnf -y install \
--setopt install_weak_deps=0 \
--nodocs \
git-core \
jq \
python3.12 \
rubygem-bundler \
rubygem-json \
subscription-manager && \
dnf clean all
###############
# BUILD/INSTALL
###############
FROM base AS builder
WORKDIR /src
RUN dnf -y install \
--setopt install_weak_deps=0 \
--nodocs \
gcc \
python3.12-devel \
python3.12-pip \
python3.12-setuptools \
&& dnf clean all
# Install dependencies in a separate layer to maximize layer caching
COPY requirements.txt .
RUN python3.12 -m venv /venv && \
/venv/bin/pip install --upgrade pip && \
/venv/bin/pip install -r requirements.txt --no-deps --no-cache-dir --require-hashes
COPY . .
RUN /venv/bin/pip install --no-cache-dir .
##########################
# ASSEMBLE THE FINAL IMAGE
##########################
FROM base
LABEL maintainer="Red Hat"
# copy Go SDK and Node.js installation from official images
COPY --from=golang /usr/local/go /usr/local/go
COPY --from=node /usr/local/lib/node_modules/corepack /usr/local/lib/corepack
COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=rust /usr/local/rustup/toolchains/*/bin/cargo /usr/bin/cargo
COPY --from=builder /venv /venv
# link corepack, yarn, and go to standard PATH location
RUN ln -s /usr/local/lib/corepack/dist/corepack.js /usr/local/bin/corepack && \
ln -s /usr/local/lib/corepack/dist/yarn.js /usr/local/bin/yarn && \
ln -s /usr/local/go/bin/go /usr/local/bin/go && \
ln -s /venv/bin/createrepo_c /usr/local/bin/createrepo_c && \
ln -s /venv/bin/cachi2 /usr/local/bin/cachi2 && \
ln -s /venv/bin/hermeto /usr/local/bin/hermeto
ENTRYPOINT ["/usr/local/bin/hermeto"]