Skip to content

Commit

Permalink
deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
acekyd committed Jul 30, 2024
1 parent fed562b commit da83d4b
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 4 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/docker-image-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

name: Build & Publish Docker Image

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
REGISTRY: ghcr.io


jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./Dockerfile
image: ghcr.io/tbd54566975/tbd-developer-mock-pfis

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ matrix.image }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: Dockerfile
push: true
target: ${{ matrix.target }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ FROM node:20.5-buster

ARG COMMIT_HASH
ENV COMMIT_HASH=${COMMIT_HASH}
ARG PORT
ENV PORT=${PORT:-8080}

WORKDIR /mock-pfis

Expand All @@ -12,7 +10,12 @@ RUN npm install

COPY tsconfig.json ./
COPY src ./src
RUN npm run compile
RUN npm run server

EXPOSE 4000
EXPOSE 5000
EXPOSE 8000
EXPOSE 8080
EXPOSE 9000

EXPOSE ${PORT}
ENTRYPOINT ["node", "dist/main.js"]
12 changes: 12 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'
services:
app:
build: .
ports:
- "4000:4000"
- "5000:5000"
- "8000:8000"
- "8080:8080"
- "9000:9000"
environment:
- NODE_ENV=production

0 comments on commit da83d4b

Please sign in to comment.