Start on building monolith image

Right now still the "old way," awaiting community input re: Dockerfiles
This commit is contained in:
Caleb Xavier Berger 2021-01-18 17:49:42 +00:00 committed by GitHub
parent ff07aa473d
commit 1aeb29ceec
3 changed files with 54 additions and 1 deletions

View file

@ -20,3 +20,35 @@ jobs:
run: echo "CC=$(./.github/workflows/get-compiler.sh ccomp)" >> $GITHUB_ENV # https://stackoverflow.com/a/57969570/3551604 run: echo "CC=$(./.github/workflows/get-compiler.sh ccomp)" >> $GITHUB_ENV # https://stackoverflow.com/a/57969570/3551604
- run: go env - run: go env
- run: ./build.sh - run: ./build.sh
- name: upload build artifacts
uses: actions/upload-artifact@v2
with:
name: bin-${{ matrix.target }}
path: ./bin
build-monolith:
strategy:
matrix:
target: [amd64, arm64, arm]
env:
DOCKER_HUB_USER: dendritegithub
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: bin-${{ matrix.target }}
# - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- run: echo "DOCKER_TARGET=$(./.github/workflows/get-compiler.sh docker)" >> $GITHUB_ENV
# For building docker images, QEMU and buildx is still easier than anything to do with docker manifest editing
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
uses: docker/build-push-action@v2
with:
context: .
file: ./build/docker/Dockerfile.monolith
platforms: ${{ env.PLATFORMS }}
push: false
tags: |
${{ env.DOCKER_NAMESPACE }}/dendrite-monolith:latest

View file

@ -1,6 +1,24 @@
#!/bin/bash #!/bin/bash
set -eu set -eu
# Given a GOARCH target, return what Docker calls that target.
function get_docker() {
case "$GOARCH" in
"amd64")
echo "linux/amd64"
;;
"arm64")
echo "linux/arm64/v8"
;;
"arm")
echo "linux/arm/v7"
;;
*)
exit 1
;;
esac
}
# Given a GOARCH target, return the GCC for that target. # Given a GOARCH target, return the GCC for that target.
function get_compiler() { function get_compiler() {
case "$GOARCH" in case "$GOARCH" in
@ -41,6 +59,9 @@ case "$1" in
"ccomp") "ccomp")
get_compiler get_compiler
;; ;;
"docker")
get_docker
;;
*) *)
exit 1 exit 1
;; ;;