-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* reorg dockerfile * Document multi-stage build process
- Loading branch information
Showing
7 changed files
with
168 additions
and
1 deletion.
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,10 @@ | ||
.git | ||
.gitignore | ||
.editorconfig | ||
**/.terraform | ||
*.tfstate | ||
*.tfstate.* | ||
.idea | ||
*.iml | ||
.build-harness | ||
build-harness |
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,24 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# Override for Makefile | ||
[{Makefile, makefile, GNUmakefile}] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[Makefile.*] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[shell] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.sh] | ||
indent_style = tab | ||
indent_size = 4 |
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,7 @@ | ||
.build-harness | ||
build-harness | ||
.terraform | ||
*.tfstate | ||
*.tfstate.* | ||
.idea | ||
*.iml |
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,8 @@ | ||
FROM alpine:3.7 | ||
ENV INSTALL_PATH=/packages/bin | ||
ENV PATH=${INSTALL_PATH}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
RUN mkdir -p ${INSTALL_PATH} | ||
RUN apk add --update --no-cache make curl coreutils libc6-compat | ||
ADD . /packages | ||
RUN make -C /packages/install/ all | ||
WORKDIR /opt |
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,21 @@ | ||
export DOCKER_ORG ?= cloudposse | ||
export DOCKER_IMAGE ?= $(DOCKER_ORG)/packages | ||
export DOCKER_TAG ?= latest | ||
export DOCKER_IMAGE_NAME ?= $(DOCKER_IMAGE):$(DOCKER_TAG) | ||
export DOCKER_BUILD_FLAGS = | ||
|
||
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness) | ||
|
||
all: init deps build install run | ||
|
||
deps: | ||
@exit 0 | ||
|
||
build: | ||
@make --no-print-directory docker:build | ||
|
||
push: | ||
docker push $(DOCKER_IMAGE) | ||
|
||
run: | ||
docker run -it ${DOCKER_IMAGE_NAME} sh |
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,90 @@ | ||
# Build a service with environment variables | ||
version: '1.0' | ||
|
||
steps: | ||
init_variables: | ||
title: Init variables | ||
image: alpine | ||
commands: | ||
- cf_export BUILD_HARNESS_VERSION=0.5.5 | ||
- cf_export GIT_BRANCH=${{CF_BRANCH}} | ||
|
||
build_image: | ||
title: Build image | ||
type: build | ||
description: Build packages | ||
image_name: packages | ||
dockerfile: Dockerfile | ||
|
||
semver: | ||
title: Export semantic version | ||
image: cloudposse/build-harness:${{BUILD_HARNESS_VERSION}} | ||
working_directory: ${{build_image}} | ||
commands: | ||
- make git/show | ||
- make semver/show | ||
- make semver/export >> ${{CF_VOLUME_PATH}}/env_vars_to_export | ||
|
||
push_image_commit: | ||
title: Push image with commit based semver tags | ||
type: push | ||
candidate: ${{build_image}} | ||
tags: | ||
- "${{SEMVERSION_COMMIT_SHORT}}" | ||
|
||
push_image_branch: | ||
title: Push image with branch based semver tags | ||
type: push | ||
candidate: ${{build_image}} | ||
tags: | ||
- "${{SEMVERSION_BRANCH_COMMIT_SHORT}}" | ||
when: | ||
condition: | ||
all: | ||
executeForBranch: "'${{SEMVERSION_BRANCH}}' != ''" | ||
|
||
push_image_tag_to_cfcr: | ||
title: Push image with tag based semver tags | ||
type: push | ||
registry: cfcr | ||
candidate: ${{build_image}} | ||
tag: "${{SEMVERSION_TAG}}" | ||
when: | ||
condition: | ||
all: | ||
executeForTag: "'${{SEMVERSION_TAG}}' != ''" | ||
|
||
push_image_tag_to_dockerhub: | ||
title: Push image with tag based semver tags | ||
type: push | ||
registry: dockerhub | ||
image_name: cloudposse/packages | ||
candidate: ${{build_image}} | ||
tag: "${{SEMVERSION_TAG}}" | ||
when: | ||
condition: | ||
all: | ||
executeForTag: "'${{SEMVERSION_TAG}}' != ''" | ||
|
||
push_image_latest_to_cfcf: | ||
title: Push image with latest tag | ||
type: push | ||
registry: cfcr | ||
candidate: ${{build_image}} | ||
tag: latest | ||
when: | ||
condition: | ||
all: | ||
executeForMasterBranch: "'${{CF_BRANCH}}' == 'master'" | ||
|
||
push_image_latest_to_dockerhub: | ||
title: Push image with latest tag | ||
type: push | ||
registry: dockerhub | ||
image_name: cloudposse/packages | ||
candidate: ${{build_image}} | ||
tag: latest | ||
when: | ||
condition: | ||
all: | ||
executeForMasterBranch: "'${{CF_BRANCH}}' == 'master'" |