forked from AutomotiveDevOps/LINFlexD_UART_MPC5744P_Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·21 lines (15 loc) · 902 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
# Viele Wege führen nach Rom.
# 八仙過海,各施各法
# 1. Put PROJ_NAME in the docker file and parse it out.
# export PROJ_NAME=`grep "^ENV PROJ_NAME" Dockerfile | cut -f3 -d" " | tr '[:upper:]' '[:lower:]'`
# 2. Use the folder name/repository as the project name
export PROJ_NAME=$(echo $(basename $(dirname $(realpath ${0}))) | tr '[:upper:]' '[:lower:]')
# Build everything.
docker build . --rm --build-arg PROJ_NAME --file Dockerfile --tag ${PROJ_NAME}:latest
# Make a directory for the build artifacts, mount it in the docker image and copy out the build artifacts.
mkdir -p ${PWD}/artifacts
docker run --rm -v ${PWD}:/artifacts ${PROJ_NAME}:latest \
cp -r /S32DS/artifacts/ /artifacts/
# Extract artifacts into artifacts. For the TUV, NTSB, FAA, et al you should probably archive the whole docker image.
cd artifacts/ && tar -xjf *.tar.bz2 --strip-components=1