mirror of
https://github.com/timmypidashev/web.git
synced 2026-04-14 11:03:50 +00:00
container building, time to fix up the web file
This commit is contained in:
@@ -2,12 +2,12 @@ version: '3'
|
|||||||
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
dns:
|
proxy:
|
||||||
container_name: dns
|
container_name: proxy
|
||||||
build:
|
build:
|
||||||
context: ./dns
|
context: ./proxy
|
||||||
dockerfile: Dockerfile.dev
|
dockerfile: Dockerfile.dev
|
||||||
args:
|
args:
|
||||||
- DNS_VERSION
|
- PROXY_VERSION
|
||||||
- BUILD_DATE
|
- BUILD_DATE
|
||||||
- GIT_COMMIT
|
- GIT_COMMIT
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
.:53 {
|
|
||||||
forward . 8.8.8.8 9.9.9.9
|
|
||||||
log
|
|
||||||
errors
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
18
project.toml
Normal file
18
project.toml
Normal file
@@ -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) <pidashev.tim@gmail.com>"]
|
||||||
|
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."
|
||||||
|
|
||||||
|
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
|
# Imported args
|
||||||
|
ARG PROXY_VERSION
|
||||||
|
ARG BUILD_DATE
|
||||||
|
ARG GIT_COMMIT
|
||||||
|
|
||||||
# Caddy base image
|
# Caddy base image
|
||||||
ARG ALPINE_VERSION=3.18
|
ARG ALPINE_VERSION=3.18
|
||||||
ARG GO_VERSION=1.21.3
|
ARG GO_VERSION=1.21.3
|
||||||
ARG CADDY_VERSION=v2.7.5
|
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 apk add -q --progress --update --no-cache git ca-certificates tzdata
|
||||||
RUN mkdir -p /caddydir/data && \
|
RUN mkdir -p /caddydir/data && \
|
||||||
chmod -R 700 /caddydir
|
chmod -R 700 /caddydir
|
||||||
|
|||||||
@@ -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"
|
|
||||||
27
web
27
web
@@ -4,23 +4,36 @@
|
|||||||
action="$1"
|
action="$1"
|
||||||
environment="$2"
|
environment="$2"
|
||||||
|
|
||||||
# Pulls project version from version.toml
|
# local args
|
||||||
project_version() {
|
config="project.toml"
|
||||||
local version=$(awk -F'[" ]+' '/^\[project\]/{getline; print $3}' "version.toml")
|
|
||||||
echo "v$version"
|
# 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
|
# Pulls container version from version.toml
|
||||||
container_version() {
|
container_version() {
|
||||||
local container="$1"
|
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"
|
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')
|
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
GIT_COMMIT=$(git rev-parse --short HEAD)
|
GIT_COMMIT=$(git rev-parse --short HEAD)
|
||||||
PROJECT_VERSION=$(project_version)
|
PROJECT_VERSION=$description
|
||||||
|
|
||||||
case $action in
|
case $action in
|
||||||
help)
|
help)
|
||||||
|
|||||||
Reference in New Issue
Block a user