Skip to content

Commit 615908a

Browse files
save
1 parent 9a8afff commit 615908a

1 file changed

Lines changed: 101 additions & 67 deletions

File tree

Dockerfile

Lines changed: 101 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,33 @@ ARG BASE_IMAGE_NAME=ubuntu-fips
77
ARG BASE_IMAGE_TAG=22.04
88
ARG ECR_URI=${ECR_ACCOUNT_ID}.dkr.ecr-fips.${ECR_REGION}.amazonaws.com/${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG}
99

10-
FROM ${ECR_URI} as ubuntu-fips-base
10+
FROM ${ECR_URI} as ubuntu-fips-python
11+
ENV REL=jammy
12+
ENV ARCH=amd64
13+
14+
# Install Python 3.10 and development tools
15+
RUN apt-get update && apt-get install -y \
16+
curl \
17+
tzdata \
18+
python3.10 \
19+
python3.10-dev \
20+
python3.10-venv \
21+
python3-pip \
22+
build-essential \
23+
libpq-dev \
24+
git \
25+
ca-certificates \
26+
openssl \
27+
xz-utils \
28+
libssl-dev && \
29+
rm -rf /var/lib/apt/lists/* && \
30+
# Update CA certificates to ensure SSL/TLS works properly
31+
update-ca-certificates && \
32+
ln -sf /usr/bin/python3.10 /usr/bin/python && \
33+
ln -sf /usr/bin/python3.10 /usr/bin/python3
34+
35+
36+
FROM ubuntu-fips-python as ubuntu-fips-python-s6-mods
1137

1238
# set version labels
1339
ARG BUILD_DATE
@@ -18,49 +44,26 @@ ARG LSIOWN_VERSION="v1"
1844
ARG S6_OVERLAY_VERSION="3.1.6.2"
1945
ARG S6_OVERLAY_ARCH="x86_64"
2046

21-
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
22-
LABEL maintainer="civisanalytics"
47+
# add s6 overlay
48+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
49+
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
50+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
51+
RUN tar -C / -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
2352

24-
# install required packages and add s6 overlay
25-
RUN \
26-
echo "**** install required packages ****" && \
27-
apt-get update && \
28-
apt-get install -y \
29-
curl \
30-
ca-certificates \
31-
xz-utils && \
32-
echo "**** add s6 overlay ****" && \
33-
curl -o /tmp/s6-overlay-noarch.tar.xz -L \
34-
"https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" && \
35-
tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && \
36-
curl -o /tmp/s6-overlay-arch.tar.xz -L \
37-
"https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz" && \
38-
tar -C / -Jxpf /tmp/s6-overlay-arch.tar.xz && \
39-
curl -o /tmp/s6-overlay-symlinks-noarch.tar.xz -L \
40-
"https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" && \
41-
tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz && \
42-
curl -o /tmp/s6-overlay-symlinks-arch.tar.xz -L \
43-
"https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz" && \
44-
tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz && \
45-
rm -rf /tmp/s6-overlay*.tar.xz
53+
# add s6 optional symlinks
54+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
55+
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
56+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
57+
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
58+
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/docker-mods.${MODS_VERSION}" "/docker-mods"
59+
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/package-install.${PKG_INST_VERSION}" "/etc/s6-overlay/s6-rc.d/init-mods-package-install/run"
60+
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/lsiown.${LSIOWN_VERSION}" "/usr/bin/lsiown"
4661

47-
# add LinuxServer.io mod scripts
48-
RUN \
49-
echo "**** add LinuxServer.io mod scripts ****" && \
50-
curl -o /docker-mods -L \
51-
"https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/docker-mods.${MODS_VERSION}" && \
52-
chmod +x /docker-mods && \
53-
mkdir -p /etc/s6-overlay/s6-rc.d/init-mods-package-install && \
54-
curl -o /etc/s6-overlay/s6-rc.d/init-mods-package-install/run -L \
55-
"https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/package-install.${PKG_INST_VERSION}" && \
56-
chmod +x /etc/s6-overlay/s6-rc.d/init-mods-package-install/run && \
57-
curl -o /usr/bin/lsiown -L \
58-
"https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/lsiown.${LSIOWN_VERSION}" && \
59-
chmod +x /usr/bin/lsiown
62+
FROM ubuntu-fips-python-s6-mods as ubuntu-fips-base
6063

6164
# set environment variables
6265
ARG DEBIAN_FRONTEND="noninteractive"
63-
ENV HOME="/root" \
66+
ENV HOME="/workspace" \
6467
LANGUAGE="en_US.UTF-8" \
6568
LANG="en_US.UTF-8" \
6669
TERM="xterm" \
@@ -71,48 +74,79 @@ ENV HOME="/root" \
7174
PATH="/lsiopy/bin:$PATH"
7275

7376
RUN \
74-
echo "**** setup LinuxServer.io environment ****" && \
75-
echo "**** create abc user and folders (if not exists) ****" && \
76-
if ! id abc >/dev/null 2>&1; then \
77-
useradd -u 911 -U -d /config -s /bin/false abc && \
78-
usermod -G users abc; \
79-
fi && \
77+
echo "**** Ripped from Ubuntu Docker Logic ****" && \
78+
set -xe && \
79+
echo '#!/bin/sh' \
80+
> /usr/sbin/policy-rc.d && \
81+
echo 'exit 101' \
82+
>> /usr/sbin/policy-rc.d && \
83+
chmod +x \
84+
/usr/sbin/policy-rc.d && \
85+
dpkg-divert --local --rename --add /sbin/initctl && \
86+
cp -a \
87+
/usr/sbin/policy-rc.d \
88+
/sbin/initctl && \
89+
sed -i \
90+
's/^exit.*/exit 0/' \
91+
/sbin/initctl && \
92+
echo 'force-unsafe-io' \
93+
> /etc/dpkg/dpkg.cfg.d/docker-apt-speedup && \
94+
echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' \
95+
> /etc/apt/apt.conf.d/docker-clean && \
96+
echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' \
97+
>> /etc/apt/apt.conf.d/docker-clean && \
98+
echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' \
99+
>> /etc/apt/apt.conf.d/docker-clean && \
100+
echo 'Acquire::Languages "none";' \
101+
> /etc/apt/apt.conf.d/docker-no-languages && \
102+
echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' \
103+
> /etc/apt/apt.conf.d/docker-gzip-indexes && \
104+
echo 'Apt::AutoRemove::SuggestsImportant "false";' \
105+
> /etc/apt/apt.conf.d/docker-autoremove-suggests && \
106+
mkdir -p /run/systemd && \
107+
echo 'docker' \
108+
> /run/systemd/container && \
109+
echo "**** install apt-utils and locales ****" && \
110+
apt-get update && \
111+
apt-get upgrade -y && \
112+
apt-get install -y \
113+
apt-utils \
114+
locales && \
115+
echo "**** install packages ****" && \
116+
apt-get install -y \
117+
catatonit \
118+
cron \
119+
curl \
120+
gnupg \
121+
jq \
122+
netcat \
123+
tzdata && \
124+
echo "**** generate locale ****" && \
125+
locale-gen en_US.UTF-8 && \
126+
echo "**** create abc user and make our folders ****" && \
127+
useradd -u 911 -U -d /workspace -s /bin/false abc && \
128+
usermod -G users abc && \
80129
mkdir -p \
81130
/app \
82131
/config \
83132
/defaults \
133+
/workspace \
84134
/lsiopy && \
85135
echo "**** cleanup ****" && \
86-
apt-get autoremove -y && \
136+
apt-get autoremove && \
87137
apt-get clean && \
88138
rm -rf \
89139
/tmp/* \
90140
/var/lib/apt/lists/* \
91141
/var/tmp/* \
92142
/var/log/*
93143

144+
FROM ubuntu-fips-base as ubuntu-fips-base-python
145+
146+
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
147+
LABEL maintainer="civisanalytics"
148+
94149
# add local files
95150
COPY root/ /
96151

97152
ENTRYPOINT ["/init"]
98-
99-
FROM ubuntu-fips-base as ubuntu-fips-base-python
100-
101-
# Install Python 3.10 and development tools
102-
RUN apt-get update && apt-get install -y \
103-
python3.10 \
104-
python3.10-dev \
105-
python3.10-venv \
106-
python3-pip \
107-
build-essential \
108-
libpq-dev \
109-
git \
110-
ca-certificates \
111-
openssl \
112-
libssl-dev && \
113-
rm -rf /var/lib/apt/lists/* && \
114-
# Update CA certificates to ensure SSL/TLS works properly
115-
update-ca-certificates && \
116-
ln -sf /usr/bin/python3.10 /usr/bin/python && \
117-
ln -sf /usr/bin/python3.10 /usr/bin/python3
118-

0 commit comments

Comments
 (0)