-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DSP-995 Building of Docker images on release (#11)
- Loading branch information
Showing
9 changed files
with
133 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# compiled output | ||
/dist | ||
/tmp | ||
|
||
# dependencies | ||
/node_modules | ||
/bower_components | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
*.launch | ||
.settings/ | ||
|
||
# misc | ||
/.sass-cache | ||
/connect.lock | ||
/coverage/* | ||
/libpeerconnection.log | ||
npm-debug.log | ||
testem.log | ||
/typings | ||
|
||
# e2e | ||
/e2e/*.js | ||
/e2e/*.map | ||
|
||
#System Files | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
test: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 50 | ||
- name: Build Docker Image | ||
run: make build-app-image | ||
- name: Publish Docker Image (on release only) | ||
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags') | ||
run: | | ||
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin | ||
make publish-app-image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
### STAGE 1: Build ### | ||
|
||
# We label our stage as 'builder' | ||
FROM node:12-stretch as builder | ||
|
||
# The qq is for silent output in the console | ||
# You are welcome to modify this part as it | ||
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev | ||
|
||
# Sets the path where the app is going to be installed | ||
ENV NODE_ROOT /usr/app/ | ||
|
||
# Creates the directory and all the parents (if they don’t exist) | ||
RUN mkdir -p $NODE_ROOT | ||
|
||
# Sets the /usr/app as the active directory | ||
WORKDIR $NODE_ROOT | ||
|
||
# Copies all the content | ||
COPY . . | ||
|
||
# Install all the packages | ||
RUN npm install -g @angular/cli | ||
RUN npm install | ||
|
||
## Build the angular app in production mode and store the artifacts in dist folder | ||
## should be: $(npm bin)/ng build --prod --env=prod --build-optimizer | ||
RUN npm run build-prod | ||
|
||
### STAGE 2: Setup ### | ||
|
||
FROM dhlabbasel/nginx-server:v1.0.1 | ||
|
||
LABEL maintainer="400790+subotic@users.noreply.github.com" | ||
|
||
RUN rm -rf /public/* | ||
|
||
COPY --from=builder /usr/app/dist/limcweb /public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Determine this makefile's path. | ||
# Be sure to place this BEFORE `include` directives, if any. | ||
# THIS_FILE := $(lastword $(MAKEFILE_LIST)) | ||
THIS_FILE := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
CURRENT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
|
||
include vars.mk | ||
|
||
.PHONY: build-app-image | ||
build-app-image: ## build and publish APP image locally | ||
docker build -t $(APP_IMAGE) . | ||
docker tag $(APP_IMAGE) $(APP_REPO):latest | ||
|
||
.PHONY: publish-app-image | ||
publish-app-image: build-app-image ## publish APP Docker image to Docker-Hub | ||
docker push $(APP_REPO) | ||
|
||
.PHONY: help | ||
help: ## this help | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort | ||
|
||
.DEFAULT_GOAL := help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
APP_REPO := daschswiss/080e-limc-app | ||
|
||
ifeq ($(BUILD_TAG),) | ||
BUILD_TAG := $(shell git describe --tag --dirty --abbrev=7) | ||
endif | ||
ifeq ($(BUILD_TAG),) | ||
BUILD_TAG := $(shell git rev-parse --verify HEAD) | ||
endif | ||
|
||
ifeq ($(APP_IMAGE),) | ||
APP_IMAGE := $(APP_REPO):$(BUILD_TAG) | ||
endif |