-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from MinusFour/feature-docker-arm
[feature] Entorno de Desarrollo para rPI
- Loading branch information
Showing
6 changed files
with
109 additions
and
1,413 deletions.
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,3 @@ | ||
docker/ | ||
node_modules/ | ||
\.github/ |
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,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 |
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,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" |
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,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"] |
Oops, something went wrong.