- added drone files

- added docker files
- added ansible deployment files
This commit is contained in:
oonyeje 2023-10-09 07:45:57 -04:00
parent 01753b87b2
commit 86f4da9749
14 changed files with 509 additions and 325 deletions

74
.drone.yml Executable file
View File

@ -0,0 +1,74 @@
kind: pipeline
type: docker
name: build
steps:
- name: build
image: timbru31/node-alpine-git:18
commands:
- yarn
# - yarn build
- name: push-image
image: plugins/docker:latest
settings:
registry: gitea.bsidesolutions.net
repo: gitea.bsidesolutions.net/oonyeje/oonyeje-portfolio
username:
from_secret: DOCKER_USERNAME
password:
from_secret: DOCKER_PASSWORD
# email:
# from_secret: DOCKER_EMAIL
tags:
- latest
dockerfile: ./Dockerfile
context: ./
# - name: deploy-staging
# image: plugins/ansible:latest
# settings:
# playbook: ansible/playbook.staging.yml
# galaxy: ansible/requirements.yml
# inventory: ansible/inventory.yml
# become_user: bside
# user: bside
# verbose: 4
# become: true
# list_tasks: true
# list_hosts: true
# private_key:
# from_secret: STAGING_SERVER_PRIVATE_KEY
# trigger:
# branch:
# - master
# - prod
# - qa
# - feature/*
# event:
# - push
# - pull_request
---
kind: pipeline
type: exec
name: staging-deploy
platform:
os: linux
arch: amd64
steps:
- name: ansible-deploy
commands:
- ansible --version
- ansible-galaxy install --force --role-file ansible/requirements.yml -vvvv
- ansible-playbook --inventory ansible/inventory.yml --list-hosts ansible/playbook.staging.yml
# trigger:
# branch:
# - master
# - prod
# - qa
# - feature/*
# event:
# - push
# - pull_request

0
.gitignore vendored Normal file → Executable file
View File

25
Dockerfile Normal file
View File

@ -0,0 +1,25 @@
FROM node:18.8-alpine as base
FROM base as builder
WORKDIR /home/node/app
COPY package*.json ./
COPY . .
RUN yarn install
# RUN yarn build
FROM base as runtime
# ENV NODE_ENV=production
WORKDIR /home/node/app
COPY package*.json ./
# RUN yarn install --production
# COPY --from=builder /home/node/app/dist ./dist
# COPY --from=builder /home/node/app/build ./build
EXPOSE 3000
CMD ["yarn", "dev", '-p', '3000']

2
ansible/inventory.yml Executable file
View File

@ -0,0 +1,2 @@
deployment_servers:
hosts: localhost

60
ansible/playbook.staging.yml Executable file
View File

@ -0,0 +1,60 @@
- name: deploy docker stack
hosts: localhost
tasks:
- name: Tear down existing services
community.docker.docker_compose:
project_src: ../
state: absent
- name: Create and start services
community.docker.docker_compose:
project_src: ../
register: output
- name: Show results
ansible.builtin.debug:
var: output
- name: Run `docker-compose up` again
community.docker.docker_compose:
project_src: ../
build: false
register: output
# - name: Show results
# ansible.builtin.debug:
# var: output
# - ansible.builtin.assert:
# that: not output.changed
# - name: Stop all services
# community.docker.docker_compose:
# project_src: ../
# build: false
# stopped: true
# register: output
- name: Show results
ansible.builtin.debug:
var: output
- name: Verify that app and db services are running
ansible.builtin.assert:
that:
- "not output.services.app.oonyeje-portfolio_app_1.state.running"
# - name: Restart services
# community.docker.docker_compose:
# project_src: ../
# build: false
# restarted: true
# register: output
- name: Show results
ansible.builtin.debug:
var: output
# - name: Verify that app and db services are running
# ansible.builtin.assert:
# that:
# - "not output.services.app.oonyeje-portfolio_app_1.state.running"

5
ansible/requirements.yml Executable file
View File

@ -0,0 +1,5 @@
collections:
# Install a collection from Ansible Galaxy.
- name: community.docker
version: ">=3.4.8"
source: https://galaxy.ansible.com

0
components/content/carousel/index.tsx Normal file → Executable file
View File

0
components/content/index.tsx Normal file → Executable file
View File

18
docker-compose.yaml Executable file
View File

@ -0,0 +1,18 @@
version: '3'
name: oonyeje-portfolio
services:
app:
image: node:18.8-alpine
build:
context: ./
dockerfile: Dockerfile
ports:
- "3000:3000"
volumes:
- .:/home/node/app
- ./node_modules:/home/node/app/node_modules
working_dir: /home/node/app/
command: sh -c "yarn install && yarn dev"
env_file:
- .env.local

0
lib/content.ts Normal file → Executable file
View File

0
lib/navigationContent.tsx Normal file → Executable file
View File

0
lib/portfolio.ts Normal file → Executable file
View File

0
pages/index.tsx Normal file → Executable file
View File

View File