Skip to content

Commit

Permalink
Merge pull request #12 from MinusFour/feature-docker-arm
Browse files Browse the repository at this point in the history
[feature] Entorno de Desarrollo para rPI
  • Loading branch information
MinusFour committed Sep 23, 2020
2 parents 1811f27 + 524b707 commit ad431c1
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 1,413 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker/
node_modules/
\.github/
71 changes: 71 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: deployment
on:
push:
branch: dev
jobs:
build_dev_pi_image:
name: Build docker image for rPIv2 (Arm v6)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
-
name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
-
name: Create builder
uses: docker/setup-buildx-action@v1

-
name: Build and push docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/armv6-node/Dockerfile
platforms: linux/arm/v6
push: true
tags:
ghcr.io/elhacker-net/web-nuevo/arm32v6/web-dev:latest
deploy_to_rpi:
name: Pull image from GHCR and run with docker-compose
needs: build_dev_pi_image
runs-on: ubuntu-18.04
env:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
SSH_PORT: ${{ secrets.SSH_PORT }}
steps:
- uses: actions/checkout@v2
-
name: Set DOCKER_HOST
run: echo "::set-env name=DOCKER_HOST::ssh://$SSH_USER@$SSH_HOST:$SSH_PORT"
-
name: Set SSH client
env:
SSH_PRIVATE_KEY: ${{ secrets.GA_PRIV_KEY }}
HOST_KEY: ${{ secrets.HOST_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
run: |
mkdir -p $HOME/.ssh
echo "$SSH_PRIVATE_KEY" > $HOME/.ssh/id_rsa
chmod 600 $HOME/.ssh/id_rsa
eval $(ssh-agent)
ssh-add $HOME/.ssh/id_rsa
echo "$SSH_HOST $HOST_KEY" > /etc/ssh/ssh_known_hosts
echo ::set-env name=SSH_AUTH_SOCK::$SSH_AUTH_SOCK
echo ::set-env name=SSH_AGENT_PID::$SSH_AGENT_PID
-
name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
-
name: Pull image and run in host
run: |
docker-compose pull
docker-compose up -d
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.0"
services:
webpack:
image: ghcr.io/elhacker-net/web-nuevo/arm32v6/web-dev:latest
container_name: webpack
restart: always
ports:
- "80:8080/tcp"
7 changes: 7 additions & 0 deletions docker/armv6-node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM arm32v6/node:current-alpine3.10 as builder
WORKDIR /home/node/app
COPY --chown=node:node . /home/node/app
RUN apk add --no-cache git
RUN npm ci
EXPOSE 8080/tcp
ENTRYPOINT ["npm", "start", "--", "--host=0.0.0.0", "--allowed-hosts", ".minusfour.net"]
Loading

0 comments on commit ad431c1

Please sign in to comment.