-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Christian Berendt <[email protected]>
- Loading branch information
Showing
12 changed files
with
163 additions
and
10 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"extends": [ | ||
"github>osism/renovate-config" | ||
"github>osism/renovate-config", | ||
"github>osism/renovate-config:docker" | ||
] | ||
} |
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,37 @@ | ||
--- | ||
name: Build container image | ||
|
||
"on": | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 22 * * *" | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build-container-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build container image | ||
run: scripts/build.sh | ||
env: | ||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} | ||
GIT_SHA: ${{ github.sha }} | ||
REPOSITORY: osism/cookiecutter | ||
|
||
- name: Push container image | ||
run: | | ||
scripts/push.sh | ||
env: | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
REPOSITORY: osism/cookiecutter | ||
if: | | ||
github.repository == 'osism/cfg-cookiecutter' && | ||
github.ref == 'refs/heads/main' |
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: Check docker syntax | ||
|
||
"on": | ||
push: | ||
paths: | ||
- "Containerfile" | ||
- .github/workflows/check-docker-syntax.yml | ||
branches: | ||
- main | ||
pull_request: | ||
paths: | ||
- "Containerfile" | ||
- .github/workflows/check-docker-syntax.yml | ||
|
||
jobs: | ||
check-docker-syntax: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: hadolint/[email protected] | ||
with: | ||
dockerfile: Containerfile |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.venv | ||
.tox | ||
cfg-customer | ||
output |
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,34 @@ | ||
ARG PYTHON_VERSION=3.9 | ||
FROM python:${PYTHON_VERSION}-alpine | ||
|
||
COPY . /data | ||
|
||
# hadolint ignore=DL3018 | ||
RUN apk add --no-cache \ | ||
bash \ | ||
git \ | ||
openssh-keygen \ | ||
pwgen \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
build-base \ | ||
cargo \ | ||
libffi-dev \ | ||
openssl-dev \ | ||
python3-dev \ | ||
rust \ | ||
&& pip3 --no-cache-dir install --upgrade 'pip==22.0.4' \ | ||
&& pip3 --no-cache-dir install -r /data/requirements.txt \ | ||
&& apk del .build-deps \ | ||
&& mkdir /output | ||
|
||
WORKDIR /data | ||
|
||
VOLUME ["/output"] | ||
CMD ["cookiecutter", "-o", "/output", "/data"] | ||
|
||
LABEL "org.opencontainers.image.documentation"="https://docs.osism.tech" \ | ||
"org.opencontainers.image.licenses"="ASL 2.0" \ | ||
"org.opencontainers.image.source"="https://github.com/osism/cfg-cookiecutter" \ | ||
"org.opencontainers.image.url"="https://www.osism.tech" \ | ||
"org.opencontainers.image.vendor"="OSISM GmbH" \ | ||
"org.opencontainers.image.title"="cookiecutter" |
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 @@ | ||
Containerfile |
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,30 @@ | ||
#!/usr/bin/env bash | ||
set -x | ||
|
||
# Available environment variables | ||
# | ||
# BUILD_OPTS | ||
# DOCKER_REGISTRY | ||
# REPOSITORY | ||
# VERSION | ||
|
||
# Set default values | ||
|
||
BUILD_OPTS=${BUILD_OPTS:-} | ||
CREATED=$(date --rfc-3339=ns) | ||
DOCKER_REGISTRY=${DOCKER_REGISTRY:-quay.io} | ||
REVISION=$(git rev-parse HEAD) | ||
VERSION=${VERSION:-latest} | ||
|
||
if [[ -n $DOCKER_REGISTRY ]]; then | ||
REPOSITORY="$DOCKER_REGISTRY/$REPOSITORY" | ||
fi | ||
|
||
buildah build-using-dockerfile \ | ||
--format docker \ | ||
--build-arg "VERSION=$VERSION" \ | ||
--tag "$(git rev-parse --short HEAD)" \ | ||
--label "org.opencontainers.image.created=$CREATED" \ | ||
--label "org.opencontainers.image.revision=$REVISION" \ | ||
--label "org.opencontainers.image.version=$VERSION" \ | ||
$BUILD_OPTS . |
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 @@ | ||
#!/usr/bin/env bash | ||
set -x | ||
|
||
# Available environment variables | ||
# | ||
# DOCKER_REGISTRY | ||
# REPOSITORY | ||
# VERSION | ||
|
||
# Set default values | ||
|
||
DOCKER_REGISTRY=${DOCKER_REGISTRY:-quay.io} | ||
VERSION=${VERSION:-latest} | ||
|
||
if [[ -n $DOCKER_REGISTRY ]]; then | ||
REPOSITORY="$DOCKER_REGISTRY/$REPOSITORY" | ||
fi | ||
|
||
buildah login --password $DOCKER_PASSWORD --username $DOCKER_USERNAME $DOCKER_REGISTRY | ||
|
||
buildah tag "$(git rev-parse --short HEAD)" "$REPOSITORY:$VERSION" | ||
buildah push "$REPOSITORY:$VERSION" |