Initial project source
这个提交包含在:
@@ -0,0 +1,28 @@
|
||||
FROM nginx:1.31.4-alpine@sha256:db35bfc6b2951e7f8a72db5db120288c127ffaeeb4a6d4b95a26fead017d5913
|
||||
|
||||
RUN apk add --no-cache \
|
||||
libcrypto3=3.5.8-r0 \
|
||||
libssl3=3.5.8-r0 \
|
||||
&& apk info -e libcrypto3=3.5.8-r0 \
|
||||
&& apk info -e libssl3=3.5.8-r0
|
||||
|
||||
ARG RELEASE_ID=local-development
|
||||
|
||||
LABEL com.aixun.project="aixun-datagov"
|
||||
LABEL org.opencontainers.image.title="AiXun-DataGov frontend"
|
||||
LABEL org.opencontainers.image.version="${RELEASE_ID}"
|
||||
|
||||
ENV AIXUN_DATAGOV_RELEASE_ID="${RELEASE_ID}" \
|
||||
AIXUN_DATAGOV_FRONTEND_SOURCE=/opt/aixun-datagov/frontend-current \
|
||||
AIXUN_DATAGOV_FRONTEND_TARGET=/usr/share/nginx/html
|
||||
|
||||
COPY aixun-ui/dist/ /opt/aixun-datagov/frontend-current/
|
||||
# Exact public-file membership distinguishes mutable public URLs from hashed
|
||||
# bundle assets. The current public tree is only 42 KB; no filename heuristic.
|
||||
COPY aixun-ui/public/ /opt/aixun-datagov/frontend-public/
|
||||
COPY script/datagov/docker/prepare-frontend-assets.sh /docker-entrypoint.d/40-aixun-datagov-frontend-assets.sh
|
||||
COPY script/datagov/nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
RUN chmod 0555 /docker-entrypoint.d/40-aixun-datagov-frontend-assets.sh
|
||||
|
||||
EXPOSE 80
|
||||
@@ -0,0 +1,37 @@
|
||||
FROM bellsoft/liberica-openjdk-rocky:21.0.12-cds@sha256:b8493dbedf98eb152731f75ef52b9e6cd2fecc0f54684d5a5d7abd7703139490
|
||||
|
||||
RUN microdnf -y --refresh --best --nodocs --setopt=install_weak_deps=0 install \
|
||||
curl-7.76.1-40.el9_8.5.x86_64 \
|
||||
libcurl-7.76.1-40.el9_8.5.x86_64 \
|
||||
glib2-2.68.4-19.el9_8.9.x86_64 \
|
||||
gnutls-3.8.10-8.el9_8.x86_64 \
|
||||
libacl-2.4.0-1.el9_8.x86_64 \
|
||||
openssl-1:3.5.5-6.el9_8.x86_64 \
|
||||
openssl-libs-1:3.5.5-6.el9_8.x86_64 \
|
||||
sqlite-libs-3.34.1-11.el9_8.x86_64 \
|
||||
&& rpm -q curl libcurl glib2 gnutls libacl openssl openssl-libs sqlite-libs \
|
||||
&& microdnf clean all \
|
||||
&& rm -rf /var/cache/dnf /var/cache/yum
|
||||
|
||||
ARG JAR_FILE
|
||||
ARG SERVICE_NAME
|
||||
ARG RELEASE_ID=local-development
|
||||
|
||||
LABEL com.aixun.project="aixun-datagov"
|
||||
LABEL org.opencontainers.image.title="AiXun-DataGov ${SERVICE_NAME}"
|
||||
LABEL org.opencontainers.image.version="${RELEASE_ID}"
|
||||
|
||||
RUN mkdir -p /aixun-datagov/app/logs /aixun-datagov/app/temp
|
||||
WORKDIR /aixun-datagov/app
|
||||
|
||||
ENV SERVER_PORT=8080 \
|
||||
LANG=C.UTF-8 \
|
||||
LC_ALL=C.UTF-8 \
|
||||
JAVA_GC_OPTS="-XX:+UseSerialGC" \
|
||||
JAVA_OPTS=""
|
||||
|
||||
COPY ${JAR_FILE} app.jar
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "-c", "exec java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} -XX:+HeapDumpOnOutOfMemoryError ${JAVA_GC_OPTS} ${JAVA_OPTS} -jar app.jar"]
|
||||
@@ -0,0 +1,150 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
source_dir="${AIXUN_DATAGOV_FRONTEND_SOURCE:-/opt/aixun-datagov/frontend-current}"
|
||||
target_dir="${AIXUN_DATAGOV_FRONTEND_TARGET:-/usr/share/nginx/html}"
|
||||
public_dir="${AIXUN_DATAGOV_FRONTEND_PUBLIC_SOURCE:-/opt/aixun-datagov/frontend-public}"
|
||||
release_id="${AIXUN_DATAGOV_RELEASE_ID:-}"
|
||||
|
||||
fail() {
|
||||
echo "DataGov frontend asset assembly failed: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
case "${release_id}" in
|
||||
""|*[!a-z0-9._-]*|current|development|latest|previous|rollback)
|
||||
fail "a non-reserved lowercase release ID is required"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${release_id}" in
|
||||
[a-z0-9]*) ;;
|
||||
*) fail "release ID must start with a lowercase letter or digit" ;;
|
||||
esac
|
||||
|
||||
[ "${#release_id}" -le 64 ] || fail "release ID exceeds 64 characters"
|
||||
[ -d "${source_dir}" ] || fail "frontend source directory is missing"
|
||||
[ -f "${source_dir}/index.html" ] || fail "frontend index.html is missing"
|
||||
[ ! -L "${source_dir}" ] || fail "frontend source directory must not be a symlink"
|
||||
[ ! -L "${target_dir}" ] || fail "frontend target directory must not be a symlink"
|
||||
|
||||
if find "${source_dir}" -type l -print -quit | grep -q .; then
|
||||
fail "frontend source must not contain symlinks"
|
||||
fi
|
||||
|
||||
mkdir -p "${target_dir}"
|
||||
file_list="$(mktemp "${target_dir}/.asset-list.${release_id}.XXXXXX")"
|
||||
activation_list="$(mktemp "${target_dir}/.entry-list.${release_id}.XXXXXX")"
|
||||
printf '%s\n' index.html index.html.gz index.html.br >"${activation_list}"
|
||||
activation_started=false
|
||||
|
||||
entry_tmp_path() {
|
||||
printf '%s/%s/.%s.%s.tmp\n' "${target_dir}" "$(dirname "$1")" "$(basename "$1")" "${release_id}"
|
||||
}
|
||||
|
||||
entry_backup_path() {
|
||||
printf '%s/%s/.%s.%s.backup\n' "${target_dir}" "$(dirname "$1")" "$(basename "$1")" "${release_id}"
|
||||
}
|
||||
|
||||
entry_missing_path() {
|
||||
printf '%s/%s/.%s.%s.missing\n' "${target_dir}" "$(dirname "$1")" "$(basename "$1")" "${release_id}"
|
||||
}
|
||||
|
||||
rollback_entries() {
|
||||
while IFS= read -r entry_name; do
|
||||
entry_backup="$(entry_backup_path "${entry_name}")"
|
||||
entry_missing="$(entry_missing_path "${entry_name}")"
|
||||
if [ -f "${entry_backup}" ]; then
|
||||
mv "${entry_backup}" "${target_dir}/${entry_name}"
|
||||
elif [ -f "${entry_missing}" ]; then
|
||||
rm -f -- "${target_dir}/${entry_name}"
|
||||
fi
|
||||
done <"${activation_list}"
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
assembly_status=$?
|
||||
trap - EXIT HUP INT TERM
|
||||
if [ "${assembly_status}" -ne 0 ] && [ "${activation_started}" = true ]; then
|
||||
rollback_entries
|
||||
fi
|
||||
while IFS= read -r entry_name; do
|
||||
rm -f -- \
|
||||
"$(entry_tmp_path "${entry_name}")" \
|
||||
"$(entry_backup_path "${entry_name}")" \
|
||||
"$(entry_missing_path "${entry_name}")"
|
||||
done <"${activation_list}"
|
||||
rm -f -- "${file_list}" "${activation_list}"
|
||||
exit "${assembly_status}"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
trap 'exit 1' HUP INT TERM
|
||||
|
||||
find "${source_dir}" -type f \
|
||||
! -path "${source_dir}/index.html" \
|
||||
! -path "${source_dir}/index.html.gz" \
|
||||
! -path "${source_dir}/index.html.br" \
|
||||
-print | LC_ALL=C sort >"${file_list}"
|
||||
|
||||
while IFS= read -r source_file; do
|
||||
[ -n "${source_file}" ] || continue
|
||||
relative_path="${source_file#"${source_dir}"/}"
|
||||
target_file="${target_dir}/${relative_path}"
|
||||
target_parent="$(dirname "${target_file}")"
|
||||
[ ! -L "${target_file}" ] || fail "target asset must not be a symlink: ${relative_path}"
|
||||
mkdir -p "${target_parent}"
|
||||
public_path="${relative_path}"
|
||||
case "${public_path}" in
|
||||
*.gz) public_path="${public_path%.gz}" ;;
|
||||
*.br) public_path="${public_path%.br}" ;;
|
||||
esac
|
||||
if [ -f "${public_dir}/${relative_path}" ] || [ -f "${public_dir}/${public_path}" ]; then
|
||||
printf '%s\n' "${relative_path}" >>"${activation_list}"
|
||||
continue
|
||||
fi
|
||||
if [ -f "${target_file}" ]; then
|
||||
cmp -s "${source_file}" "${target_file}" || fail "immutable asset collision: ${relative_path}"
|
||||
else
|
||||
asset_tmp="${target_file}.tmp.${release_id}"
|
||||
[ ! -e "${asset_tmp}" ] || fail "temporary asset path already exists: ${relative_path}"
|
||||
cp "${source_file}" "${asset_tmp}"
|
||||
mv "${asset_tmp}" "${target_file}"
|
||||
fi
|
||||
done <"${file_list}"
|
||||
|
||||
while IFS= read -r entry_name; do
|
||||
source_entry="${source_dir}/${entry_name}"
|
||||
target_entry="${target_dir}/${entry_name}"
|
||||
entry_tmp="$(entry_tmp_path "${entry_name}")"
|
||||
entry_backup="$(entry_backup_path "${entry_name}")"
|
||||
entry_missing="$(entry_missing_path "${entry_name}")"
|
||||
|
||||
[ ! -L "${target_entry}" ] || fail "target entry must not be a symlink: ${entry_name}"
|
||||
[ ! -e "${entry_tmp}" ] || fail "temporary entry path already exists: ${entry_name}"
|
||||
[ ! -e "${entry_backup}" ] || fail "backup entry path already exists: ${entry_name}"
|
||||
[ ! -e "${entry_missing}" ] || fail "missing marker path already exists: ${entry_name}"
|
||||
|
||||
if [ -f "${source_entry}" ]; then
|
||||
cp "${source_entry}" "${entry_tmp}"
|
||||
fi
|
||||
if [ -f "${target_entry}" ]; then
|
||||
cp "${target_entry}" "${entry_backup}"
|
||||
else
|
||||
: >"${entry_missing}"
|
||||
fi
|
||||
done <"${activation_list}"
|
||||
|
||||
activation_started=true
|
||||
while IFS= read -r entry_name; do
|
||||
source_entry="${source_dir}/${entry_name}"
|
||||
target_entry="${target_dir}/${entry_name}"
|
||||
entry_tmp="$(entry_tmp_path "${entry_name}")"
|
||||
if [ -f "${source_entry}" ]; then
|
||||
mv "${entry_tmp}" "${target_entry}"
|
||||
else
|
||||
rm -f -- "${target_entry}"
|
||||
fi
|
||||
done <"${activation_list}"
|
||||
activation_started=false
|
||||
|
||||
echo "DataGov frontend assets assembled: release=${release_id} old_hash_assets_preserved=true"
|
||||
@@ -0,0 +1,10 @@
|
||||
FROM redis:8.6.6-alpine@sha256:2c9168169a7017f4726aef4646bec0fc8e473d760ca8b733b570133fd94cda5b
|
||||
|
||||
RUN apk add --no-cache \
|
||||
libcrypto3=3.5.8-r0 \
|
||||
libssl3=3.5.8-r0 \
|
||||
&& apk info -e libcrypto3=3.5.8-r0 \
|
||||
&& apk info -e libssl3=3.5.8-r0
|
||||
|
||||
LABEL com.aixun.project="aixun-datagov"
|
||||
LABEL org.opencontainers.image.title="AiXun-DataGov Redis"
|
||||
在新工单中引用
屏蔽一个用户