Release, components and repos as build args
This commit is contained in:
parent
fe54727339
commit
1cf350e597
|
@ -55,12 +55,20 @@ ARG EMAIL_ADDRESS="youremail@example.com"
|
||||||
ARG GPG_PASSWORD="PickAPassword"
|
ARG GPG_PASSWORD="PickAPassword"
|
||||||
ARG HOSTNAME=localhost
|
ARG HOSTNAME=localhost
|
||||||
ARG MODE=packages
|
ARG MODE=packages
|
||||||
|
ARG UBUNTU_RELEASE=xenial
|
||||||
|
ARG UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
|
||||||
|
ARG COMPONENTS="main universe"
|
||||||
|
ARG REPOS="${UBUNTU_RELEASE} ${UBUNTU_RELEASE}-updates ${UBUNTU_RELEASE}-security"
|
||||||
|
|
||||||
ENV FULL_NAME ${FULL_NAME}
|
ENV FULL_NAME ${FULL_NAME}
|
||||||
ENV EMAIL_ADDRESS ${EMAIL_ADDRESS}
|
ENV EMAIL_ADDRESS ${EMAIL_ADDRESS}
|
||||||
ENV GPG_PASSWORD ${GPG_PASSWORD}
|
ENV GPG_PASSWORD ${GPG_PASSWORD}
|
||||||
ENV HOSTNAME ${HOSTNAME}
|
ENV HOSTNAME ${HOSTNAME}
|
||||||
ENV MODE ${MODE}
|
ENV MODE ${MODE}
|
||||||
|
ENV UBUNTU_RELEASE=${UBUNTU_RELEASE}
|
||||||
|
ENV UPSTREAM_URL=${UPSTREAM_URL}
|
||||||
|
ENV COMPONENTS=${COMPONENTS}
|
||||||
|
ENV REPOS=${REPOS}
|
||||||
|
|
||||||
COPY assets/packages /opt/packages
|
COPY assets/packages /opt/packages
|
||||||
COPY assets/gpg/* /opt/aptly/
|
COPY assets/gpg/* /opt/aptly/
|
||||||
|
|
|
@ -11,11 +11,6 @@ set -x
|
||||||
# For more detail about each of the variables below refer to:
|
# For more detail about each of the variables below refer to:
|
||||||
# https://help.ubuntu.com/community/Repositories/CommandLine
|
# https://help.ubuntu.com/community/Repositories/CommandLine
|
||||||
|
|
||||||
UBUNTU_RELEASE=xenial
|
|
||||||
UPSTREAM_URL="http://archive.ubuntu.com/ubuntu/"
|
|
||||||
COMPONENTS=( main universe )
|
|
||||||
REPOS=( ${UBUNTU_RELEASE} ${UBUNTU_RELEASE}-updates ${UBUNTU_RELEASE}-security )
|
|
||||||
|
|
||||||
if [ "$MODE" = "packages" ]; then
|
if [ "$MODE" = "packages" ]; then
|
||||||
FILTER_OPTS=(-filter="$(cat /opt/packages | paste -sd \| -)" -filter-with-deps)
|
FILTER_OPTS=(-filter="$(cat /opt/packages | paste -sd \| -)" -filter-with-deps)
|
||||||
else
|
else
|
||||||
|
@ -24,8 +19,8 @@ fi
|
||||||
|
|
||||||
# Create repository mirrors if they don't exist
|
# Create repository mirrors if they don't exist
|
||||||
set +e
|
set +e
|
||||||
for component in ${COMPONENTS[@]}; do
|
for component in ${COMPONENTS}; do
|
||||||
for repo in ${REPOS[@]}; do
|
for repo in ${REPOS}; do
|
||||||
aptly mirror list -raw | grep "^${repo}-${component}$"
|
aptly mirror list -raw | grep "^${repo}-${component}$"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Creating mirror of ${repo}-${component} repository."
|
echo "Creating mirror of ${repo}-${component} repository."
|
||||||
|
@ -37,16 +32,16 @@ done
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Update all repository mirrors
|
# Update all repository mirrors
|
||||||
for component in ${COMPONENTS[@]}; do
|
for component in ${COMPONENTS}; do
|
||||||
for repo in ${REPOS[@]}; do
|
for repo in ${REPOS}; do
|
||||||
echo "Updating ${repo}-${component} repository mirror.."
|
echo "Updating ${repo}-${component} repository mirror.."
|
||||||
aptly mirror update ${repo}-${component}
|
aptly mirror update ${repo}-${component}
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# Create snapshots of updated repositories
|
# Create snapshots of updated repositories
|
||||||
for component in ${COMPONENTS[@]}; do
|
for component in ${COMPONENTS}; do
|
||||||
for repo in ${REPOS[@]}; do
|
for repo in ${REPOS}; do
|
||||||
echo "Creating snapshot of ${repo}-${component} repository mirror.."
|
echo "Creating snapshot of ${repo}-${component} repository mirror.."
|
||||||
SNAPSHOTARRAY+="${repo}-${component}-`date +%Y%m%d%H` "
|
SNAPSHOTARRAY+="${repo}-${component}-`date +%Y%m%d%H` "
|
||||||
aptly snapshot create ${repo}-${component}-`date +%Y%m%d%H` from mirror ${repo}-${component}
|
aptly snapshot create ${repo}-${component}-`date +%Y%m%d%H` from mirror ${repo}-${component}
|
||||||
|
|
Loading…
Reference in New Issue