Skip to content

Commit

Permalink
feat: merge branch dev into stage (#21)
Browse files Browse the repository at this point in the history
* fix: #15 (#19)

Co-authored-by: adriantoral <[email protected]>

* feat: dockerhub deployment workflow (#18)

---------

Co-authored-by: adriantoral <[email protected]>
Co-authored-by: adriantoral <[email protected]>
  • Loading branch information
3 people authored Mar 23, 2024
1 parent 273c3f7 commit 0194912
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 34 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/deploy-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Docker Image

on:
pull_request:
branches:
- stage
types:
- closed

jobs:
if_merged:
if: github.event.pull_request.merged == true
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: my-docker-hub-namespace/my-docker-hub-repository

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ FROM node:18

WORKDIR /usr/src/app

COPY package*.json ./
RUN npm install
RUN npm install -g typescript
# Config files
COPY *.json .
COPY *lint* .

COPY . .
# Source code
COPY .husky .husky
COPY src src

# Build
RUN npm install
RUN npm install -g typescript
RUN tsc

CMD [ "node", "dist/index.js" ]
CMD [ "node", "dist/index.js" ]
24 changes: 0 additions & 24 deletions Makefile

This file was deleted.

8 changes: 3 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
version: '3'

services:
saasbot:
build: .
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
command: node dist/index.js

environment:
NODE_ENV: development
NODE_ENV: development

0 comments on commit 0194912

Please sign in to comment.