Skip to content

Commit

Permalink
Update image deployment procedure
Browse files Browse the repository at this point in the history
Build and push image with `kbplacer` added to `-primary` image.
Added test for double check if it is working in container as well.
Push only from `master` branch.
  • Loading branch information
adamws committed Dec 30, 2022
1 parent 83cbec7 commit d3fb021
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
34 changes: 21 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,32 @@ jobs:
- store_artifacts:
path: release/kicad-kbplacer.zip
deploy-image:
docker:
- image: cimg/base:2021.04
machine:
image: ubuntu-2204:2022.10.2
steps:
- checkout
- setup_remote_docker
- run:
name: Build and push Docker image
name: Setup environment variables
command: |
echo 'export TAG="0.2.${CIRCLE_SHA1}"' >> "$BASH_ENV"
echo 'export IMAGE_NAME="kicad-kbplacer"' >> "$BASH_ENV"
- run:
name: Build and test docker image
command: |
export TAG=0.2.${CIRCLE_SHA1}
export IMAGE_NAME=kicad-kbplacer
docker build -t admwscki/$IMAGE_NAME:$TAG -f docker/Dockerfile .
docker tag admwscki/$IMAGE_NAME:$TAG admwscki/$IMAGE_NAME:latest
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_LOGIN --password-stdin
docker push admwscki/$IMAGE_NAME:$TAG
docker push admwscki/$IMAGE_NAME:latest
docker run --rm -v $(pwd)/tests:/kicad/tests -v $(pwd)/examples:/kicad/examples \
-w /kicad/tests admwscki/$IMAGE_NAME:$TAG \
/bin/bash -c "pip3 install -r dev-requirements.txt && /kicad/.local/bin/pytest -c /dev/null"
- run:
name: Push docker image
command: |
if [ "${CIRCLE_BRANCH}" = "master" ]
then
docker tag admwscki/$IMAGE_NAME:$TAG admwscki/$IMAGE_NAME:latest
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_LOGIN --password-stdin
docker push admwscki/$IMAGE_NAME:$TAG
docker push admwscki/$IMAGE_NAME:latest
fi
workflows:
main:
jobs:
Expand All @@ -58,6 +69,3 @@ workflows:
- deploy-image:
requires:
- create-release
filters:
branches:
only: master
14 changes: 11 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
FROM admwscki/kicad-kbplacer-primary:6.0-lunar

RUN useradd --create-home --shell /bin/bash kicad \
RUN userdel -r ubuntu

ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o kicad \
&& useradd -u $UID -g $GID --create-home --shell /bin/bash kicad \
&& usermod -m -d /kicad kicad

USER kicad
WORKDIR /kicad

RUN mkdir -p /kicad/.local/share/kicad/6.0/3rdparty/plugins/
COPY --chown=kicad:kicad kbplacer/ /kicad/.local/share/kicad/6.0/3rdparty/plugins/com_github_adamws_kicad-kbplacer/
ARG PLUGINS_PATH=/kicad/.local/share/kicad/6.0/3rdparty/plugins
RUN mkdir -p $PLUGINS_PATH
COPY --chown=kicad:kicad kbplacer/ $PLUGINS_PATH/com_github_adamws_kicad-kbplacer/

ENV PYTHONPATH "${PYTHONPATH}:${PLUGINS_PATH}"

0 comments on commit d3fb021

Please sign in to comment.