-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile
60 lines (53 loc) · 1.91 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
FROM registry.access.redhat.com/ubi9/ubi@sha256:1057dab827c782abcfb9bda0c3900c0966b5066e671d54976a7bcb3a2d1a5e53 as ubi
FROM docker.io/library/golang:1.20.0-bullseye as golang_120
FROM docker.io/library/golang:1.21.0-bullseye as golang_121
FROM docker.io/library/node:23.3.0-bullseye as node
########################
# PREPARE OUR BASE IMAGE
########################
FROM ubi as base
RUN dnf -y install \
--setopt install_weak_deps=0 \
--nodocs \
git-core \
python3 \
rubygem-bundler \
rubygem-json \
subscription-manager && \
dnf clean all
######################
# BUILD/INSTALL CACHI2
######################
FROM base as builder
WORKDIR /src
COPY . .
RUN dnf -y install \
--setopt install_weak_deps=0 \
--nodocs \
gcc \
python3-devel \
python3-pip \
python3-setuptools \
&& dnf clean all
RUN python3 -m venv /venv && \
/venv/bin/pip install --upgrade pip && \
/venv/bin/pip install -r requirements.txt --no-deps --no-cache-dir --require-hashes && \
/venv/bin/pip install --no-cache-dir .
##########################
# ASSEMBLE THE FINAL IMAGE
##########################
FROM base
LABEL maintainer="Red Hat"
# copy Go SDKs and Node.js installation from official images
COPY --from=golang_120 /usr/local/go /usr/local/go/go1.20
COPY --from=golang_121 /usr/local/go /usr/local/go/go1.21
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=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/go1.21/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
ENTRYPOINT ["/usr/local/bin/cachi2"]