Skip to content

Commit

Permalink
Build arm64 docker image (#80)
Browse files Browse the repository at this point in the history
`node:14.19.3-buster-slim` instead of `node:14.19.3-alpine`
  • Loading branch information
boonya authored Jun 20, 2022
1 parent 71710d4 commit 60738d6
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 20 deletions.
57 changes: 52 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ jobs:
METEOR=$(cat .meteor/release | awk -F'@' '{print $2}')
echo ::set-output name=meteor::${METEOR}
NAME=$(cat package.json | jq -r '.name')
echo ::set-output name=name::${NAME}
DESCRIPTION=$(cat package.json | jq -r '.description')
echo ::set-output name=description::${DESCRIPTION}
LICENSE=$(cat package.json | jq -r '.license')
echo ::set-output name=license::${LICENSE}
REPOSITORY=$(cat package.json | jq -r '.repository')
echo ::set-output name=repository::${REPOSITORY}
VERSION=$(cat package.json | jq -r '.version')
echo ::set-output name=version::${VERSION}
Expand All @@ -35,16 +43,31 @@ jobs:
echo ::set-output name=bundle::${BUNDLE}
META=$( jq -n \
--arg meteor ${METEOR} \
--arg version ${VERSION} \
--arg hash ${HASH} \
--arg bundle ${BUNDLE} \
'{"meteor": $meteor, "version": $version, "hash": $hash, "bundle": $bundle}'
--arg meteor "${METEOR}" \
--arg name "${NAME}" \
--arg description "${DESCRIPTION}" \
--arg license "${LICENSE}" \
--arg repository "${REPOSITORY}" \
--arg version "${VERSION}" \
--arg hash "${HASH}" \
--arg bundle "${BUNDLE}" \
'{
"meteor": $meteor,
"name": $name,
"description": $description,
"license": $license,
"repository": $repository,
"version": $version,
"hash": $hash,
"bundle": $bundle
}'
)
echo ${META} > meta.json
echo "meteor version: ${METEOR}"
echo "package version: ${VERSION}"
echo "package name: ${NAME}"
echo "package description: ${DESCRIPTION}"
echo "hash: ${HASH}"
echo "bundle name: ${BUNDLE}"
Expand All @@ -67,6 +90,7 @@ jobs:
${{ steps.meta.outputs.bundle }}
.dockerignore
Dockerfile
mongo/initdb.d
docker-compose.yaml
.env.mongo.template
.env.recorder.template
Expand All @@ -88,10 +112,26 @@ jobs:
id: meta
run: |
VERSION=$(cat meta.json | jq -r '.version')
echo ::set-output name=version::${VERSION}
BUNDLE=$(cat meta.json | jq -r '.bundle')
echo ::set-output name=bundle::${BUNDLE}
HASH=$(cat meta.json | jq -r '.hash')
echo ::set-output name=hash::${HASH}
NAME=$(cat meta.json | jq -r '.name')
echo ::set-output name=name::${NAME}
DESCRIPTION=$(cat meta.json | jq -r '.description')
echo ::set-output name=description::${DESCRIPTION}
LICENSE=$(cat meta.json | jq -r '.license')
echo ::set-output name=license::${LICENSE}
REPOSITORY=$(cat meta.json | jq -r '.repository')
echo ::set-output name=repository::${REPOSITORY}
CREATED=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=created::${CREATED}
TAGS="${{ env.GHCR_IMAGE }}:${HASH},${{ env.GHCR_IMAGE }}:${GITHUB_REF_NAME}"
echo ::set-output name=tags::${TAGS}
Expand All @@ -115,6 +155,13 @@ jobs:
context: .
build-args: |
BUNDLE=${{ steps.meta.outputs.bundle }}
TITLE=${{ steps.meta.outputs.name }}
DESCRIPTION=${{ steps.meta.outputs.description }}
LICENSES=${{ steps.meta.outputs.license }}
SOURCE=${{ steps.meta.outputs.repository }}
VERSION=${{ steps.meta.outputs.version }}
REVISION=${{ steps.meta.outputs.hash }}
CREATED=${{ steps.meta.outputs.created }}
platforms: linux/amd64, linux/arm64
tags: ${{ steps.meta.outputs.tags }}
push: true
37 changes: 31 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,43 @@
FROM node:14.19.3-alpine as builder
FROM node:14.19.3-buster-slim as builder

ARG BUNDLE=meteor-recorder.tar.gz
COPY $BUNDLE meteor-bundle.tar.gz

RUN apk add --no-cache --virtual .gyp python3 make g++ \
&& tar -xzvf meteor-bundle.tar.gz \
RUN tar -xzvf meteor-bundle.tar.gz \
&& apt-get update \
&& apt-get install -y python3 make g++ \
&& rm meteor-bundle.tar.gz \
&& (cd bundle/programs/server && npm install)

FROM node:14.19.3-alpine
FROM node:14.19.3-buster-slim

ARG TITLE="meteor-recorder"
ARG LICENSES="MIT"
ARG SOURCE="https://github.com/boonya/meteor-recorder"
ARG AUTHORS="Serhii [boonya] Buinytskyi <[email protected]>"
ARG DESCRIPTION
ARG VERSION
ARG REVISION
ARG CREATED

LABEL org.opencontainers.image.base.name "node:14.19.3-buster-slim"
LABEL org.opencontainers.image.title $TITLE
LABEL org.opencontainers.image.licenses $LICENSES
LABEL org.opencontainers.image.source $SOURCE
LABEL org.opencontainers.image.authors $AUTHORS
LABEL org.opencontainers.image.description $DESCRIPTION
LABEL org.opencontainers.image.version $VERSION
LABEL org.opencontainers.image.revision $REVISION
LABEL org.opencontainers.image.created $CREATED

ENV RECORDER_FOLDER="/mnt" \
ROOT_URL="http://localhost:3000" \
PORT=3000

WORKDIR /usr/src/app
COPY --from=builder bundle .

RUN apk add --no-cache ffmpeg
VOLUME /mnt
RUN apt-get update \
&& apt-get install -y ffmpeg

CMD ["node", "main.js"]
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ use ${MONGO_DB}

```sh
docker run --rm --name meteor-recorder \
--privileged \
--env TZ=Europe/Kiev \
-p 3000:3000 \
-v $HOME/Movies/recorder/:/media/Recorder/:rw \
-v /etc/localtime:/etc/localtime:ro \
--env-file .env.recorder \
--env MONGO_URL=mongodb://recorder:${MONGO_PASSWORD}@localhost:27017/recorder \
-v $HOME/Movies/recorder:/mnt:rw \
--env RECORDER_DIR_SIZE_THRESHOLD=200G \
--env RECORDER_SEGMENT_TIME=600 \
--env NODE_ENV=development \
--env DEBUG=true \
boonya/meteor-recorder:${tag}
```
16 changes: 13 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
version: '3'

services:
recorder:
container_name: meteor-recorder
image: boonya/meteor-recorder:latest
networks:
- db
privileged: true
depends_on:
- mongo
ports:
- 3000:3000
volumes:
- $HOME/Movies/recorder/:/media/Recorder/:rw
- $HOME/Movies/recorder:/mnt:rw
- /etc/localtime:/etc/localtime:ro
env_file:
- .env.recorder
- .env.recorder
environment:
NODE_ENV: development
restart: unless-stopped

mongo:
container_name: meteor-recorder-mongo
image: mongo:4.4.10
networks:
- db
ports:
- 27017:27017
volumes:
Expand All @@ -28,9 +33,14 @@ services:
- mongo-db:/data/db
- /etc/localtime:/etc/localtime:ro
env_file:
- .env.mongo
- .env.mongo
restart: unless-stopped

volumes:
mongo-configdb:
mongo-db:


networks:
db:
name: meteor-recorder
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meteor-recorder",
"version": "1.4.1",
"version": "1.4.2",
"description": "Video Recorder application that captures IP Web Cams RTSP streams",
"license": "MIT",
"repository": "https://github.com/boonya/meteor-recorder",
Expand Down

0 comments on commit 60738d6

Please sign in to comment.