-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 Discord bot should be alive from prod
- Loading branch information
Showing
2 changed files
with
77 additions
and
3 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,66 @@ | ||
name: 'Build & Deployment' | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: ${{ github.ref_name }} | ||
|
||
steps: | ||
# Checkout the repo | ||
- uses: actions/checkout@v2 | ||
|
||
# Setup Docker Buildx | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Build and push Docker Image | ||
- name: Login to Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Preset Image Name | ||
run: echo "IMAGE_URL=$(echo ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:$(echo ${{ github.sha }} | cut -c1-7) | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Build and push Docker Image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ env.IMAGE_URL }} | ||
build-args: | | ||
DOPPLER_TOKEN=${{ secrets.DOPPLER_TOKEN }} | ||
# Deploy to CapRover | ||
- name: Deploy Image to CapRover | ||
uses: caprover/[email protected] | ||
with: | ||
server: "${{ vars.CAPROVER_SERVER }}" | ||
app: "${{ vars.APP_NAME }}" | ||
token: "${{ secrets.CAPROVER_APP_TOKEN }}" | ||
image: ${{ env.IMAGE_URL }} | ||
|
||
- name: send telegram message | ||
uses: appleboy/telegram-action@master | ||
if: always() | ||
with: | ||
to: ${{ secrets.TELEGRAM_GROUP_CHAT_ID }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
message: | | ||
💸🤖 *[PROD Dólar en bancos bots]* | ||
🧾 *Status: ${{ job.status }}* | ||
#️⃣ Run # ${{github.run_number}}. Event type: *${{ github.event_name }}* | ||
🤡 Developer: *${{github.actor}}* | ||
🔗 Href: https://github.com/${{github.repository}} | ||
✨ See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | ||
format: markdown | ||
disable_web_page_preview: "True" |
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 |
---|---|---|
@@ -1,12 +1,20 @@ | ||
# Use an official Node.js runtime as the base image | ||
FROM node:20.10-alpine | ||
|
||
ARG DOPPLER_TOKEN | ||
ENV DOPPLER_TOKEN=$DOPPLER_TOKEN | ||
|
||
# Set the working directory in the container to /app | ||
WORKDIR /app | ||
|
||
# Update and install dependencies | ||
# Add Doppler's RSA key | ||
RUN wget -q -t3 'https://packages.doppler.com/public/cli/rsa.8004D9FF50437357.key' -O /etc/apk/keys/[email protected] | ||
|
||
# Install Doppler CLI | ||
RUN apk add --no-cache curl && \ | ||
curl -Ls https://cli.doppler.com/install.sh | sh | ||
# Add Doppler's apk repo | ||
RUN echo 'https://packages.doppler.com/public/cli/alpine/any-version/main' | tee -a /etc/apk/repositories | ||
RUN apk update && apk add --no-cache libffi-dev openssl-dev build-base curl doppler | ||
|
||
# Copy package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
@@ -21,4 +29,4 @@ COPY . . | |
EXPOSE 3000 | ||
|
||
# Define the command to run the application | ||
CMD ["doppler", "run", "--", "npm", "start"] | ||
CMD ["doppler", "run", "--", "npm", "start"] |