Skip to content

Commit b041b31

Browse files
thatguyinabeanieopencode
andcommitted
remove Python dependencies from Ubuntu FIPS base image
🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode <[email protected]>
1 parent 647ece9 commit b041b31

5 files changed

Lines changed: 58 additions & 16 deletions

File tree

Dockerfile

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ 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-python-s6
10+
FROM ${ECR_URI} as ubuntu-fips-s6
1111
# set version labels
1212
ARG BUILD_DATE
1313
ARG VERSION
@@ -23,26 +23,21 @@ LABEL maintainer="civisanalytics"
2323
ENV REL=jammy
2424
ENV ARCH=amd64
2525

26-
# Install Python 3.10 and development tools
26+
# Install base development tools (no Python)
2727
RUN apt-get update && apt-get install -y \
2828
curl \
2929
tzdata \
30-
python3.10 \
31-
python3.10-dev \
32-
python3.10-venv \
33-
python3-pip \
3430
build-essential \
3531
libpq-dev \
3632
git \
3733
ca-certificates \
3834
openssl \
3935
xz-utils \
4036
libssl-dev && \
37+
# Clean up
4138
rm -rf /var/lib/apt/lists/* && \
4239
# Update CA certificates to ensure SSL/TLS works properly
43-
update-ca-certificates && \
44-
ln -sf /usr/bin/python3.10 /usr/bin/python && \
45-
ln -sf /usr/bin/python3.10 /usr/bin/python3
40+
update-ca-certificates
4641

4742
# add s6 overlay
4843
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
@@ -61,7 +56,7 @@ ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-s
6156
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"
6257
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/lsiown.${LSIOWN_VERSION}" "/usr/bin/lsiown"
6358

64-
FROM ubuntu-fips-python-s6 as linuxserver-python-base
59+
FROM ubuntu-fips-s6 as linuxserver-base
6560

6661
# set environment variables
6762
ARG DEBIAN_FRONTEND="noninteractive"
@@ -71,9 +66,7 @@ ENV HOME="/workspace" \
7166
TERM="xterm" \
7267
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \
7368
S6_VERBOSITY=1 \
74-
S6_STAGE2_HOOK=/docker-mods \
75-
VIRTUAL_ENV=/lsiopy \
76-
PATH="/lsiopy/bin:$PATH"
69+
S6_STAGE2_HOOK=/docker-mods
7770

7871
RUN \
7972
echo "**** Ripped from Ubuntu Docker Logic ****" && \
@@ -132,8 +125,7 @@ RUN \
132125
/app \
133126
/config \
134127
/defaults \
135-
/workspace \
136-
/lsiopy && \
128+
/workspace && \
137129
echo "**** cleanup ****" && \
138130
apt-get autoremove && \
139131
apt-get clean && \

buildspec/merge_master.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 0.2
2+
phases:
3+
pre_build:
4+
commands:
5+
- echo Logging in to Amazon ECR...
6+
- aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${FIPS_REPOSITORY_URI}
7+
build:
8+
commands:
9+
- echo Building the Docker image...
10+
- docker build -t ${FIPS_REPOSITORY_URI}:latest .
11+
- docker image push --all-tags ${FIPS_REPOSITORY_URI}
12+
post_build:
13+
commands:
14+
- echo Build completed!

buildspec/push.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 0.2
2+
phases:
3+
build:
4+
commands:
5+
- echo Logging in to Amazon ECR...
6+
- aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${FIPS_REPOSITORY_URI}
7+
- export COMMIT_HASH_SHORT="$(echo $COMMIT_HASH | cut -c 1-7)"
8+
- echo Building the Docker image...
9+
- echo $FIPS_REPOSITORY_URI
10+
- echo $COMMIT_HASH_SHORT
11+
- echo $BRANCH_NAME
12+
- docker build --tag ${FIPS_REPOSITORY_URI}:${COMMIT_HASH_SHORT} --tag ${FIPS_REPOSITORY_URI}:${BRANCH_NAME} .
13+
# We have a life cycle policy in place to expire and delete images from dev branches,
14+
# so there are no issues with pushing as many of these images as there may be.
15+
- docker image push --all-tags ${FIPS_REPOSITORY_URI}
16+
post_build:
17+
commands:
18+
- echo Build completed!
19+
- printf '{"tag":"%s"}' $COMMIT_HASH_SHORT > build.json

buildspec/release.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
version: 0.2
3+
phases:
4+
build:
5+
commands:
6+
- echo Logging in to Amazon ECR...
7+
- aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${FIPS_REPOSITORY_URI}
8+
- echo Building the Docker image...
9+
- PATCH_TAG=${TAG_NAME#"v"} # major.minor.patch
10+
- MINOR_TAG=${PATCH_TAG%.*} # major.minor
11+
- MAJOR_TAG=${MINOR_TAG%.*} # major
12+
- docker build -t ${FIPS_REPOSITORY_URI}:${PATCH_TAG} -t ${FIPS_REPOSITORY_URI}:${MINOR_TAG} -t ${FIPS_REPOSITORY_URI}:${MAJOR_TAG} .
13+
- docker image push --all-tags ${FIPS_REPOSITORY_URI}
14+
post_build:
15+
commands:
16+
- echo Build completed!
17+
- printf '{"tag":"%s"}' $TAG_NAME > build.json

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
build:
66
context: .
77
dockerfile: Dockerfile
8-
target: linuxserver-python-base
8+
target: linuxserver-base
99
platforms:
1010
- linux/amd64
1111
args:

0 commit comments

Comments
 (0)