Compare commits
28
Commits
v2.0.0-beta.6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
614e2bf992 | ||
|
|
7b15a90c53 | ||
|
|
2f5c30a000 | ||
|
|
146dae5d12 | ||
|
|
0133c453d2 | ||
|
|
f667e4abdf | ||
|
|
8d21e941b2 | ||
|
|
f167b102d2 | ||
|
|
96c7efca99 | ||
|
|
ce84d2f999 | ||
|
|
5be6a1559c | ||
|
|
f0502ce017 | ||
|
|
29aa3417aa | ||
|
|
d907c21f91 | ||
|
|
62186ceeda | ||
|
|
9cc5f8d447 | ||
|
|
7a5eec0701 | ||
|
|
afe73ec179 | ||
|
|
df9744c199 | ||
|
|
c101479a7b | ||
|
|
2bb4de67f4 | ||
|
|
d8ac4f5c4b | ||
|
|
5f009bec97 | ||
|
|
321811e74b | ||
|
|
c6f9bbd721 | ||
|
|
0f17b95fec | ||
|
|
d47f512872 | ||
|
|
ce1a6c87d3 |
+3
-3
@@ -1,12 +1,12 @@
|
|||||||
# Arguments
|
# Arguments
|
||||||
ARG NODE_TAG=16.13.1
|
ARG NODE_TAG=18.15.0
|
||||||
ARG PYBRICKSCODE_TAG=v2.0.0-beta.6
|
ARG PYBRICKSCODE_TAG=v2.3.0-beta.1
|
||||||
|
|
||||||
# Build stage
|
# Build stage
|
||||||
FROM node:${NODE_TAG} AS build-stage
|
FROM node:${NODE_TAG} AS build-stage
|
||||||
ARG PYBRICKSCODE_TAG
|
ARG PYBRICKSCODE_TAG
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN git clone https://github.com/pybricks/pybricks-code -b "${PYBRICKSCODE_TAG}" /app
|
RUN git clone https://github.com/pybricks/pybricks-code.git -b "${PYBRICKSCODE_TAG}" /app
|
||||||
RUN cd /app
|
RUN cd /app
|
||||||
RUN yarn install
|
RUN yarn install
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
NODE_TAG: ${NODE_TAG:-16.13.1}
|
NODE_TAG: ${NODE_TAG:-18.15.0}
|
||||||
PYBRICKSCODE_TAG: ${PYBRICKSCODE_TAG:-v2.0.0-beta.6}
|
PYBRICKSCODE_TAG: ${PYBRICKSCODE_TAG:-v2.3.0-beta.1}
|
||||||
restart: ${RESTART:-unless-stopped}
|
restart: ${RESTART:-unless-stopped}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: curl -f http://localhost:80/ || exit 1
|
test: curl -f http://localhost:80/ || exit 1
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ services:
|
|||||||
# Pybricks Code
|
# Pybricks Code
|
||||||
pybrickscode:
|
pybrickscode:
|
||||||
container_name: ${PYBRICKSCODE_CONTAINER_NAME:-PybricksCode}
|
container_name: ${PYBRICKSCODE_CONTAINER_NAME:-PybricksCode}
|
||||||
image: axchrono/pybrickscode:${PYBRICKSCODE_TAG:-v2.0.0-beta.6}
|
image: axchrono/pybrickscode:${PYBRICKSCODE_TAG:-v2.3.0-beta.1}
|
||||||
restart: ${RESTART:-unless-stopped}
|
restart: ${RESTART:-unless-stopped}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: curl -f http://localhost:80/ || exit 1
|
test: curl -f http://localhost:80/ || exit 1
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Run this script to update this repository and get in sync with the latest Pybricks Code tag.
|
||||||
|
|
||||||
|
# Files to update automatically with the new tags.
|
||||||
|
FILES_TO_UPDATE=(
|
||||||
|
"Dockerfile"
|
||||||
|
"docker-compose.yml"
|
||||||
|
"docker-compose.build.yml"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Save the current tags of the docker repository in a variable.
|
||||||
|
PYBRICKSCODE_TAG_OLD=$(cat Dockerfile | grep -o 'ARG PYBRICKSCODE_TAG=[^ ,]\+' | sed s/"ARG PYBRICKSCODE_TAG="//)
|
||||||
|
NODEJS_TAG_OLD=$(cat Dockerfile | grep -o 'ARG NODE_TAG=[^ ,]\+' | sed s/"ARG NODE_TAG="//)
|
||||||
|
|
||||||
|
# Download the latest version of Pybricks Code in a temporary folder.
|
||||||
|
git clone https://github.com/pybricks/pybricks-code.git ./.temp/pybricks-code
|
||||||
|
|
||||||
|
# Save the current tags of the program repository in a variable.
|
||||||
|
cd ./.temp/pybricks-code
|
||||||
|
PYBRICKSCODE_TAG_NEW=$(git tag --sort=creatordate | grep -C1 -Fx $PYBRICKSCODE_TAG_OLD | tail -1)
|
||||||
|
PYBRICKSCODE_TAG_NEWER=$(git tag --sort=creatordate | grep -A2 -Fx $PYBRICKSCODE_TAG_OLD | tail -1)
|
||||||
|
PYBRICKSCODE_TAG_LATEST=$(git tag --sort=creatordate | tail -1)
|
||||||
|
# Only reason the new tag will be empty is when the old tag is not in the git tag list.
|
||||||
|
# This can also be exploited to start fresh and create every a container for every tag.
|
||||||
|
if [[ $PYBRICKSCODE_TAG_NEW == '' ]]; then
|
||||||
|
PYBRICKSCODE_TAG_NEW=$(git tag --sort=creatordate | head -1)
|
||||||
|
PYBRICKSCODE_TAG_NEWER=$(git tag --sort=creatordate | head -2)
|
||||||
|
fi
|
||||||
|
git checkout $PYBRICKSCODE_TAG_NEW
|
||||||
|
NODEJS_TAG_NEW=$(cat .tool-versions | grep -o 'nodejs [^ ,]\+' | sed s/"nodejs "//)
|
||||||
|
cd ..
|
||||||
|
cd ..
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Remove the temporary files.
|
||||||
|
rm -rf ./.temp
|
||||||
|
|
||||||
|
# Echo the old and new tags to the cosole.
|
||||||
|
echo "Old Pybricks Code tag: $PYBRICKSCODE_TAG_OLD"
|
||||||
|
echo "New Pybricks Code tag: $PYBRICKSCODE_TAG_NEW"
|
||||||
|
echo "Old NodeJS tag: $NODEJS_TAG_OLD"
|
||||||
|
echo "New NodeJS tag: $NODEJS_TAG_NEW"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Check if there is a newer tag that the tag we current update to.
|
||||||
|
EXTRA_UPDATE_RUN=false
|
||||||
|
if [[ "$PYBRICKSCODE_TAG_NEW" != "$PYBRICKSCODE_TAG_LATEST" ]]; then
|
||||||
|
EXTRA_UPDATE_RUN=true
|
||||||
|
echo "$PYBRICKSCODE_TAG_LATEST is the latest version but in this run the repository will be updated to $PYBRICKSCODE_TAG_NEW."
|
||||||
|
echo "After this update run the update again to update to $PYBRICKSCODE_TAG_NEWER"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If no update is needed, exit the script.
|
||||||
|
if [[ "$PYBRICKSCODE_TAG_OLD" == "$PYBRICKSCODE_TAG_NEW" ]]; then
|
||||||
|
echo "Docker tag and program tag are the same. No update needed"
|
||||||
|
|
||||||
|
# Wait for the user to exit the script.
|
||||||
|
read -p "Press the [Enter] key to exit..."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If an update is possible wait for the user to continue.
|
||||||
|
if [[ $1 != auto_update ]]; then
|
||||||
|
echo "Does the above look OK?"
|
||||||
|
read -p "Press the [Enter] key to continue..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update the tags in the different files.
|
||||||
|
for i in "${!FILES_TO_UPDATE[@]}"; do
|
||||||
|
sed -i "s/$PYBRICKSCODE_TAG_OLD/$PYBRICKSCODE_TAG_NEW/g" ${FILES_TO_UPDATE[i]}
|
||||||
|
sed -i "s/$NODEJS_TAG_OLD/$NODEJS_TAG_NEW/g" ${FILES_TO_UPDATE[i]}
|
||||||
|
done
|
||||||
|
|
||||||
|
# Commit the new update to the git repository and set the new tag.
|
||||||
|
git add .
|
||||||
|
git commit -m $PYBRICKSCODE_TAG_NEW
|
||||||
|
git tag $PYBRICKSCODE_TAG_NEW
|
||||||
|
|
||||||
|
# Build the Dockerfile and push to DokcerHub.
|
||||||
|
# Check if the new tag is a beta tag and set the docker tags acordingly.
|
||||||
|
if [[ "$PYBRICKSCODE_TAG_NEW" == *"beta"* ]]; then
|
||||||
|
docker build --rm -f "Dockerfile" \
|
||||||
|
-t axchrono/pybrickscode:$PYBRICKSCODE_TAG_NEW \
|
||||||
|
-t axchrono/pybrickscode:latest-beta \
|
||||||
|
"."
|
||||||
|
docker image push axchrono/pybrickscode:$PYBRICKSCODE_TAG_NEW
|
||||||
|
docker image push axchrono/pybrickscode:latest-beta
|
||||||
|
# Check if the new tag is a release candidate tag and set the docker tags acordingly.
|
||||||
|
elif [[ "$PYBRICKSCODE_TAG_NEW" == *"rc"* ]]; then
|
||||||
|
docker build --rm -f "Dockerfile" \
|
||||||
|
-t axchrono/pybrickscode:$PYBRICKSCODE_TAG_NEW \
|
||||||
|
-t axchrono/pybrickscode:latest-beta \
|
||||||
|
-t axchrono/pybrickscode:latest-rc \
|
||||||
|
"."
|
||||||
|
docker image push axchrono/pybrickscode:$PYBRICKSCODE_TAG_NEW
|
||||||
|
docker image push axchrono/pybrickscode:latest-beta
|
||||||
|
docker image push axchrono/pybrickscode:latest-rc
|
||||||
|
# If the new tag is not a beta or release candidate asume that it is a stable release.
|
||||||
|
else
|
||||||
|
docker build --rm -f "Dockerfile" \
|
||||||
|
-t axchrono/pybrickscode:$PYBRICKSCODE_TAG_NEW \
|
||||||
|
-t axchrono/pybrickscode:latest-beta \
|
||||||
|
-t axchrono/pybrickscode:latest-rc \
|
||||||
|
-t axchrono/pybrickscode:latest \
|
||||||
|
"."
|
||||||
|
docker image push axchrono/pybrickscode:$PYBRICKSCODE_TAG_NEW
|
||||||
|
docker image push axchrono/pybrickscode:latest-beta
|
||||||
|
docker image push axchrono/pybrickscode:latest-rc
|
||||||
|
docker image push axchrono/pybrickscode:latest
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run if there is still an update left to do.
|
||||||
|
if [[ "$EXTRA_UPDATE_RUN" == true ]]; then
|
||||||
|
echo ""
|
||||||
|
if [[ $1 != auto_update ]]; then
|
||||||
|
read -p "Press the [Enter] key to do a run for $PYBRICKSCODE_TAG_NEWER..."
|
||||||
|
fi
|
||||||
|
clear
|
||||||
|
./update.sh $1
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for the user to exit the script.
|
||||||
|
read -p "Press the [Enter] key to exit..."
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user