Skip to content

Commit

Permalink
build: Change docker image, enable server build
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolajb committed Oct 8, 2024
1 parent e73f0e4 commit 61c1941
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 18 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,17 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
GIT_TAG: ${{ env.GIT_TAG }}
run: devbox run -- just release-oci

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Release kommander applications server
env:
GIT_TAG: ${{ env.GIT_TAG }}
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
devbox run -- just release-server
34 changes: 26 additions & 8 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,29 @@ archive_name := "kommander-applications-" + git_tag+ ".tar.gz"
published_url := "https://downloads.d2iq.com" / s3_path / archive_name

release publish="true" tmp_dir=`mktemp --directory`: (_prepare-archive tmp_dir) && _cleanup
if {{ publish }}; then aws s3 cp --acl {{ s3_acl }} {{ archive_name }} {{ s3_uri }}; fi
@echo "Published to {{ published_url }}"
#!/usr/bin/env bash
set -euox pipefail
if {{ publish }}; then
aws s3 cp --acl {{ s3_acl }} {{ archive_name }} {{ s3_uri }}
echo "Published to {{ published_url }}"
else
echo "Skipping publish"
fi
release-oci publish="true" tmp_dir=`mktemp --directory`: (_prepare-files-for-a-bundle tmp_dir)
if {{ publish }}; then \
cd {{ tmp_dir }} && echo "${DOCKER_PASSWORD}" | oras push --password-stdin --username "${DOCKER_USERNAME}" --verbose {{ registry }}/{{ repository }}:{{ git_tag }} .;
#!/usr/bin/env bash
set -euox pipefail
cd {{ tmp_dir }}
if {{ publish }}; then
oras push --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}" --verbose {{ registry }}/{{ repository }}:{{ git_tag }} .
else
echo "Skipping publish"
fi
release-server publish="true" tmp_dir=`mktemp --directory`: (_prepare-archive tmp_dir) && _cleanup
cp {{ archive_name }} ./server/
cd ./server && docker buildx build . --tag {{ server_docker_repository }}:{{ git_tag }} --build-arg ARCHIVE_NAME={{ archive_name }}
rm ./server/{{ archive_name }}
release-server publish="true" tmp_dir=`mktemp --directory`: (_prepare-git-repository tmp_dir)
cp -r {{ tmp_dir }} ./server/data/
cd ./server && docker buildx build . --tag {{ server_docker_repository }}:{{ git_tag }}
rm -rf ./server/data/
if {{ publish }}; then docker push {{ server_docker_repository }}:{{ git_tag }}; fi

service_version:=`ls services/git-operator/ | grep -E "v?[[:digit:]]\.[[:digit:]]\.[[:digit:]]"`
Expand All @@ -44,11 +55,18 @@ git-operator-fetch-manifests tmp_dir=`mktemp --directory`:
_prepare-archive dir: (_prepare-files-for-a-bundle dir)
tar -cvzf {{ justfile_directory() }}/{{ archive_name }} -C {{ dir }} .

_prepare-git-repository output_dir tmp_dir_for_cloning=`mktemp --directory`:
cd {{ output_dir }} && git init --bare --initial-branch=main
git clone {{ output_dir }} {{ tmp_dir_for_cloning }}
just --justfile {{ justfile() }} --working-directory {{ invocation_directory() }} _prepare-files-for-a-bundle {{ tmp_dir_for_cloning }}
cd {{ tmp_dir_for_cloning }} && git add . && git commit --message "initial commit" && git push origin main

_cleanup:
rm {{ archive_name }}

_prepare-files-for-a-bundle output_dir:
rsync --quiet --archive --recursive --files-from={{ include_file }} --exclude-from={{ exclude_file }} {{ justfile_directory() }} {{ output_dir }}
yq 'del(.resources[] | select(. == "ai-navigator-repos.yaml"))' --inplace {{ output_dir }}/common/helm-repositories/kustomization.yaml


import 'just/test.just'
16 changes: 6 additions & 10 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
FROM sigoden/dufs
FROM alpine:3.20.3

ARG ARCHIVE_NAME
RUN apk add --update git && \
apk add --update git-daemon \
rm -rf /var/cache/apk/*

# Dufs settings:
ENV DUFS_BIND=127.0.0.1
ENV DUFS_PORT=5000
ENV DUFS_TLS_CERT=cert.pem
ENV DUFS_TLS_KEY=key.pem
COPY --chown=1000:1000 data /data

COPY ${ARCHIVE_NAME} /data/

CMD ["/data"]
CMD ["git", "daemon", "--verbose", "--port=12345","--export-all", "/data"]

0 comments on commit 61c1941

Please sign in to comment.