Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Entorno de Desarrollo para rPI #12

Merged
merged 4 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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