fix(account,ci): adjust image digests and simplify account config handling
This commit is contained in:
parent
5f6f8e2b3a
commit
e4869b9ed5
22
.github/workflows/build-service-images.yml
vendored
22
.github/workflows/build-service-images.yml
vendored
@ -7,21 +7,21 @@ on:
|
||||
description: "Push service images instead of local builds"
|
||||
type: boolean
|
||||
default: true
|
||||
go_runtime_digest:
|
||||
type: string
|
||||
default: ""
|
||||
postgres_runtime_digest:
|
||||
type: string
|
||||
default: ""
|
||||
node_runtime_digest:
|
||||
type: string
|
||||
default: ""
|
||||
node_builder_digest:
|
||||
type: string
|
||||
default: ""
|
||||
default: "ghcr.io/cloud-neutral-toolkit/node-builder:latest"
|
||||
openresty_geoip_digest:
|
||||
type: string
|
||||
default: ""
|
||||
default: "ghcr.io/cloud-neutral-toolkit/openresty-geoip:latest"
|
||||
node_runtime_digest:
|
||||
type: string
|
||||
default: "ghcr.io/cloud-neutral-toolkit/node-runtime:latest"
|
||||
go_runtime_digest:
|
||||
type: string
|
||||
default: "ghcr.io/cloud-neutral-toolkit/go-runtime:latest"
|
||||
postgres_runtime_digest:
|
||||
type: string
|
||||
default: "ghcr.io/cloud-neutral-toolkit/postgres-runtime:latest"
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
|
||||
@ -1,37 +1,38 @@
|
||||
# Multi-stage production build for the account service
|
||||
|
||||
# ------------------------------
|
||||
# Stage 1 — Build
|
||||
# ------------------------------
|
||||
ARG GO_BASE_IMAGE
|
||||
|
||||
FROM ${GO_BASE_IMAGE} AS builder
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates make \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN make build && make -pv /out/ && cp account /out/
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /out/account ./account/cmd/account
|
||||
|
||||
# PROD Image
|
||||
|
||||
# ------------------------------
|
||||
# Stage 2 — Runtime
|
||||
# ------------------------------
|
||||
ARG GO_BASE_IMAGE
|
||||
FROM ${GO_BASE_IMAGE} AS runtime
|
||||
|
||||
ENV CONFIG_PATH=/etc/xcontrol/account/account.yaml \
|
||||
PORT=8080
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /out/account /usr/local/bin/account
|
||||
COPY account/config/account.yaml /etc/xcontrol/account/account.yaml
|
||||
COPY account-entrypoint.sh /usr/local/bin/account-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/account-entrypoint.sh
|
||||
|
||||
VOLUME ["/etc/xcontrol/account"]
|
||||
COPY --from=builder /out/account /usr/local/bin/account
|
||||
COPY account-entrypoint.sh /usr/local/bin/account-entrypoint.sh
|
||||
RUN mkdir -p /etc/xcontrol/ && chmod +x /usr/local/bin/account-entrypoint.sh
|
||||
|
||||
VOLUME ["/etc/xcontrol/"]
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/account-entrypoint.sh"]
|
||||
CMD []
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
CONFIG_FILE="${CONFIG_PATH:-/etc/xcontrol/account/account.yaml}"
|
||||
DEFAULT_CONFIG="/etc/xcontrol/account/account.yaml"
|
||||
CONFIG_FILE="${CONFIG_PATH:-/etc/xcontrol/account.yaml}"
|
||||
DEFAULT_CONFIG="/etc/xcontrol/account.yaml"
|
||||
mkdir -p "$(dirname "${CONFIG_FILE}")"
|
||||
|
||||
if [ ! -f "${CONFIG_FILE}" ]; then
|
||||
@ -27,4 +27,3 @@ if [ -n "${PORT:-}" ]; then
|
||||
fi
|
||||
|
||||
exec /usr/local/bin/accountsvc --config "${CONFIG_FILE}" "$@"
|
||||
SCRIPT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user