Add pinafore
This commit is contained in:
parent
a763fa76aa
commit
45ad373c06
36
pinafore/Dockerfile.arm64v8
Normal file
36
pinafore/Dockerfile.arm64v8
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# Using Alpine to keep the images smaller
|
||||||
|
FROM arm64v8/alpine:latest
|
||||||
|
|
||||||
|
ARG TAG
|
||||||
|
ARG VERSION
|
||||||
|
ARG BUILD_DATE
|
||||||
|
ARG GIT_REPOSITORY
|
||||||
|
|
||||||
|
# Pushing all files into image
|
||||||
|
WORKDIR /app
|
||||||
|
ADD $GIT_REPOSITORY/archive/v$TAG.tar.gz /app
|
||||||
|
RUN tar zxf v$TAG.tar.gz \
|
||||||
|
&& mv pinafore-$TAG/* . \
|
||||||
|
&& rm -rf pinafore-$TAG
|
||||||
|
|
||||||
|
# Install updates and NodeJS+Dependencies
|
||||||
|
RUN apk add --update --no-cache --virtual build-dependencies git python build-base clang \
|
||||||
|
# Install updates and NodeJS+Dependencies
|
||||||
|
&& apk add --update --no-cache nodejs npm \
|
||||||
|
# Install yarn
|
||||||
|
&& npm i yarn -g \
|
||||||
|
# Install Pinafore
|
||||||
|
&& yarn --production --pure-lockfile \
|
||||||
|
&& yarn build \
|
||||||
|
&& yarn cache clean \
|
||||||
|
&& rm -rf ./src \
|
||||||
|
# Cleanup
|
||||||
|
&& apk del build-dependencies
|
||||||
|
|
||||||
|
# Expose port 4002
|
||||||
|
EXPOSE 4002
|
||||||
|
|
||||||
|
# Setting run-command, using explicit `node` command
|
||||||
|
# rather than `yarn` or `npm` to use less memory
|
||||||
|
# https://github.com/nolanlawson/pinafore/issues/971
|
||||||
|
CMD PORT=4002 node server.js
|
57
pinafore/build.sh
Executable file
57
pinafore/build.sh
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/usr/bin//env bash
|
||||||
|
|
||||||
|
DEFAULT_REPOSITORY=https://github.com/nolanlawson/pinafore
|
||||||
|
|
||||||
|
BUILD_DATE=$(date)
|
||||||
|
VERSION=$1
|
||||||
|
TAG=$2
|
||||||
|
GIT_REPOSITORY=${3:-$DEFAULT_REPOSITORY}
|
||||||
|
|
||||||
|
function require() {
|
||||||
|
if [ "$1" = "" ]; then
|
||||||
|
echo "input '$2' required"
|
||||||
|
print_help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_help() {
|
||||||
|
echo "build.sh"
|
||||||
|
echo ""
|
||||||
|
echo "Usage:"
|
||||||
|
echo " build.sh [version] [tag] [repository]"
|
||||||
|
echo ""
|
||||||
|
echo "Args:"
|
||||||
|
echo " version: The version of the current container, ex. r0"
|
||||||
|
echo " tag: The tag of pinafore to include, ex 1.15.8"
|
||||||
|
echo " repository: The git repository to fetch pinafore from (optional, defaults to https://github.com/nolanlawson/pinafore)"
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_image() {
|
||||||
|
IMAGE=$1
|
||||||
|
ARCH=$2
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
--pull \
|
||||||
|
--no-cache \
|
||||||
|
--build-arg BUILD_DATE="${BUILD_DATE}" \
|
||||||
|
--build-arg TAG="${TAG}" \
|
||||||
|
--build-arg VERSION="${VERSION}" \
|
||||||
|
--build-arg GIT_REPOSITORY="${GIT_REPOSITORY}" \
|
||||||
|
-f "Dockerfile.${ARCH}" \
|
||||||
|
-t "${IMAGE}:$(echo ${TAG} | sed 's/\//-/g')-${VERSION}-${ARCH}" \
|
||||||
|
-t "${IMAGE}:latest-${ARCH}" \
|
||||||
|
-t "${IMAGE}:latest" \
|
||||||
|
.
|
||||||
|
|
||||||
|
docker push "${IMAGE}:$(echo ${TAG} | sed 's/\//-/g')-${VERSION}-${ARCH}"
|
||||||
|
docker push "${IMAGE}:latest-${ARCH}"
|
||||||
|
docker push "${IMAGE}:latest"
|
||||||
|
}
|
||||||
|
|
||||||
|
require "$VERSION" "version"
|
||||||
|
require "$TAG" "tag"
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
build_image asonix/pinafore arm64v8
|
Loading…
Reference in a new issue