Skip to content

Commit

Permalink
ci(workflow): change workflow logic from running docker compose to ru…
Browse files Browse the repository at this point in the history
…nning dockerfile
  • Loading branch information
infinitedim committed May 19, 2024
1 parent 7c15f8d commit e5417a0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
name: Build Backend and Docker Image
name: Docker Image CI

on:
push:
branches: ["main", "dev"]
branches:
- main
- dev
paths:
- 'apps/backend/**'
- "apps/backend/**"

jobs:
build-and-lint:
build:
runs-on: ubuntu-latest

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker Image
working-directory: apps/backend
run: docker-compose build --pull --no-cache
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
7 changes: 7 additions & 0 deletions apps/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM postgres:15

ENV POSTGRES_USER=${POSTGRES_USER}
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ENV POSTGRES_DB=devix_admin

COPY init.sql /docker-entrypoint-initdb.d/
16 changes: 10 additions & 6 deletions apps/backend/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
version: "3"

services:
devixid:
image: "postgres:15"
build:
context: .
dockerfile: Dockerfile
image: devixid
ports:
- "5434:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: devix_admin
devixid_dev:
image: "postgres:15"
build:
context: .
dockerfile: Dockerfile
image: devixid_dev
ports:
- "5435:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: devix_admin_dev

0 comments on commit e5417a0

Please sign in to comment.