-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: docker container and auto build (#3)
* feat: docker container and auto build * fix base image * cross build even on push for better checks * fix docker * docs: docker build badge * use text in aedes help docs
- Loading branch information
1 parent
2728d35
commit b45d9e1
Showing
5 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.git | ||
.github | ||
*.md | ||
docs | ||
.vscode | ||
.nyc_output | ||
.coverage | ||
test | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Docker Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: crazy-max/ghaction-docker-buildx@v1 | ||
|
||
- name: Just build on PR without push | ||
if: ${{ github.event_name == 'pull_request' }} | ||
run: | | ||
docker buildx build \ | ||
-f docker/Dockerfile \ | ||
--platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386 \ | ||
-t moscajs/aedes:dev \ | ||
. | ||
- name: Login to dockerhub | ||
if: ${{ github.event_name != 'pull_request' }} | ||
run: | | ||
docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- uses: crazy-max/ghaction-docker-buildx@v1 | ||
if: ${{ github.event_name != 'pull_request' }} | ||
|
||
- name: Dev | ||
if: ${{ github.ref == 'refs/heads/master'}} | ||
run: | | ||
docker buildx build \ | ||
-f docker/Dockerfile \ | ||
--platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386 \ | ||
-t moscajs/aedes:dev \ | ||
--push \ | ||
. | ||
- name: Latest & tag | ||
if: ${{ github.event_name == 'release' }} | ||
run: | | ||
docker buildx build \ | ||
-f docker/Dockerfile \ | ||
--platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386 \ | ||
-t moscajs/aedes:$(echo ${GITHUB_REF} | sed "s/refs\/tags\/v//") \ | ||
-t moscajs/aedes:latest \ | ||
--push \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM node:erbium-alpine | ||
|
||
LABEL maintainer="robertsLando" | ||
|
||
WORKDIR /usr/src/app/ | ||
|
||
COPY . . | ||
|
||
RUN npm install | ||
|
||
EXPOSE 1883 3000 8883 4000 | ||
|
||
ENTRYPOINT [ "/usr/src/app/bin/aedes" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: '3.7' | ||
services: | ||
aedes: | ||
container_name: aedes | ||
image: moscajs/aedes:latest | ||
restart: always | ||
stop_signal: SIGINT | ||
ports: | ||
- '1883:1883' | ||
- '3000:3000' | ||
- '4000:4000' | ||
- '8883:8883' | ||
mongo: | ||
container_name: mongo | ||
logging: | ||
driver: none | ||
image: mvertes/alpine-mongo | ||
volumes: | ||
- db-data:/data/db | ||
ports: | ||
- "27017:27017" |