diff --git a/compose.dev.yml b/compose.dev.yml index adffc3e..1262018 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -2,12 +2,12 @@ version: '3' services: - dns: - container_name: dns + proxy: + container_name: proxy build: - context: ./dns + context: ./proxy dockerfile: Dockerfile.dev args: - - DNS_VERSION + - PROXY_VERSION - BUILD_DATE - GIT_COMMIT diff --git a/dns/.keep b/dns/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/dns/Corefile b/dns/Corefile deleted file mode 100644 index 8ea5437..0000000 --- a/dns/Corefile +++ /dev/null @@ -1,5 +0,0 @@ -.:53 { - forward . 8.8.8.8 9.9.9.9 - log - errors -} diff --git a/dns/Dockerfile.dev b/dns/Dockerfile.dev deleted file mode 100644 index 8b90a58..0000000 --- a/dns/Dockerfile.dev +++ /dev/null @@ -1,20 +0,0 @@ -# Imported args -ARG BUILD_DATE -ARG GIT_COMMIT -ARG DNS_VERSION - -# Print the values of the build arguments -RUN echo "DNS_VERSION=$DNS_VERSION" - -# CoreDNS base image -ARG ALPINE_VERSION=3.18 -ARG GO_VERSION=1.21.3 -ARG COREDNS_VERSION=v1.11.1 - -FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder -RUN apk add -q --progress --update --no-cache git ca-certificates libcap2-bin - -ENV GO111MODULE=on \ - CGO_ENABLED=0 - -go install github.com/coredns/coredns/tree/v1.11.1 diff --git a/dns/Dockerfile.prod b/dns/Dockerfile.prod deleted file mode 100644 index e69de29..0000000 diff --git a/project.toml b/project.toml new file mode 100644 index 0000000..94da57b --- /dev/null +++ b/project.toml @@ -0,0 +1,18 @@ +# The following version number is incremented whenever +# a container in this repository recieves a version bump! + +[project] +name = "web" +version = "1.0.1" +description = "My portfolio website!" +authors = ["Timothy Pidashev (timmypidashev) "] +source = "https://github.com/timmypidashev/web" +license = "MIT" + +[containers] + + [proxy] + version = "0.0.0" + description = "Responsible for proxying all traffic from containers to the web." + + diff --git a/proxy/Dockerfile.dev b/proxy/Dockerfile.dev index b31b4a4..1f9d274 100644 --- a/proxy/Dockerfile.dev +++ b/proxy/Dockerfile.dev @@ -1,9 +1,15 @@ +# Imported args +ARG PROXY_VERSION +ARG BUILD_DATE +ARG GIT_COMMIT + # Caddy base image ARG ALPINE_VERSION=3.18 ARG GO_VERSION=1.21.3 ARG CADDY_VERSION=v2.7.5 -FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder +FROM golang:${GO_VERSION}-alpine${PROXY_VERSION} AS builder + RUN apk add -q --progress --update --no-cache git ca-certificates tzdata RUN mkdir -p /caddydir/data && \ chmod -R 700 /caddydir diff --git a/version.toml b/version.toml deleted file mode 100644 index 4649821..0000000 --- a/version.toml +++ /dev/null @@ -1,9 +0,0 @@ -# The following version number is incremented whenever -# a container in this repository recieves a version bump! - -[project] -version = "1.0.1" - -[containers] -dns = "0.0.0" -proxy = "0.0.0" diff --git a/web b/web index a9222e3..ffbef0f 100755 --- a/web +++ b/web @@ -4,23 +4,36 @@ action="$1" environment="$2" -# Pulls project version from version.toml -project_version() { - local version=$(awk -F'[" ]+' '/^\[project\]/{getline; print $3}' "version.toml") - echo "v$version" +# local args +config="project.toml" + +# pull project info from project.toml +project_info() { + local name=$(awk -F'[" ]+' '/^\[project\]/{getline; print $3}' "$config") + # project_version + local description=$(awk -F'[" ]+' '/description =/{print $3}' "$config") + local authors=$(awk -F'[" ]+' '/authors =/{gsub(/[\[\]]/, ""); getline; print $0}' "$config") + local src=$(awk -F'[" ]+' '/source =/{print $3}' "$config") + local license=$(awk -F'[" ]+' '/license =/{print $3}' "$config") + + echo "$name $description $authors $src $license" } # Pulls container version from version.toml container_version() { local container="$1" - local version=$(awk -F'[" ]+' -v container="$container" '/^\[containers\]/{block=$1} block == "[containers]" && $1 == container {getline; print $3}' "version.toml") + local version=$(awk -F'[" ]+' -v container="$container" '/^\[containers\]/{block=$1} block == "[containers]" && $1 == container {getline; print $3}' "$config") echo "v$version" } -# Set the build arguments as environment variables +# Pull project info +INFO=$(project_info) +echo $INFO +read -r name description authors src license <<< "$result" +echo $project_version BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') GIT_COMMIT=$(git rev-parse --short HEAD) -PROJECT_VERSION=$(project_version) +PROJECT_VERSION=$description case $action in help)