mirror of
https://github.com/IT4Change/boilerplate-backend.git
synced 2025-12-13 10:25:49 +00:00
docker fixes
This commit is contained in:
parent
d38f8e0125
commit
8765d7904f
3
.github/file-filters.yml
vendored
3
.github/file-filters.yml
vendored
@ -9,6 +9,9 @@ backend-test-unit-code: &backend-test-unit-code
|
|||||||
backend-test-build-code: &backend-test-build-code
|
backend-test-build-code: &backend-test-build-code
|
||||||
- '**/*'
|
- '**/*'
|
||||||
|
|
||||||
|
backend-test-build-docker: &backend-test-build-docker
|
||||||
|
- '**/*'
|
||||||
|
|
||||||
backend-test-build-docs: &backend-test-build-docs
|
backend-test-build-docs: &backend-test-build-docs
|
||||||
- '**/*.md'
|
- '**/*.md'
|
||||||
- '.vuepress/*'
|
- '.vuepress/*'
|
||||||
46
.github/workflows/backend.test.build.docker.yml
vendored
Normal file
46
.github/workflows/backend.test.build.docker.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
name: "backend:test:build test docker"
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# only (but most important) job from this workflow required for pull requests
|
||||||
|
# check results serve as run conditions for all other jobs here
|
||||||
|
files-changed:
|
||||||
|
name: Detect File Changes - backend-test-build-docker
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
changes: ${{ steps.changes.outputs.backend-test-build-docker }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check for backend file changes
|
||||||
|
uses: dorny/paths-filter@v3.0.1
|
||||||
|
id: changes
|
||||||
|
with:
|
||||||
|
token: ${{ github.token }}
|
||||||
|
filters: .github/file-filters.yml
|
||||||
|
list-files: shell
|
||||||
|
|
||||||
|
build-production:
|
||||||
|
if: needs.files-changed.outputs.changes == 'true'
|
||||||
|
name: Build Docker Production - Backend
|
||||||
|
needs: files-changed
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Backend | Build Docker Production
|
||||||
|
run: docker compose -f docker-compose.yml build
|
||||||
|
|
||||||
|
build-development:
|
||||||
|
if: needs.files-changed.outputs.changes == 'true'
|
||||||
|
name: Build Docker Development - Backend
|
||||||
|
needs: files-changed
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Backend | Build Docker Development
|
||||||
|
run: docker compose build
|
||||||
@ -63,7 +63,7 @@ FROM base as documentation
|
|||||||
# Run command
|
# Run command
|
||||||
# (for development we need to execute npm install since the
|
# (for development we need to execute npm install since the
|
||||||
# node_modules are on another volume and need updating)
|
# node_modules are on another volume and need updating)
|
||||||
# CMD /bin/sh -c "npm install && npm run docs:dev"
|
CMD /bin/sh -c "npm install && npm run docs:dev"
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
# BUILD (Does contain all files and is therefore bloated) ########################
|
# BUILD (Does contain all files and is therefore bloated) ########################
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
version: '3.4'
|
version: '3.4'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# ######################################################
|
#######################################################
|
||||||
# BACKEND ##############################################
|
# BACKEND #############################################
|
||||||
# ######################################################
|
#######################################################
|
||||||
backend:
|
backend:
|
||||||
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
|
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
|
||||||
image: it4c/backend:local-development
|
image: it4c/backend:local-development
|
||||||
build:
|
build:
|
||||||
target: development
|
target: development
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV="development"
|
- NODE_ENV=development
|
||||||
# - DEBUG=true
|
|
||||||
volumes:
|
volumes:
|
||||||
# This makes sure the docker container has its own node modules.
|
# This makes sure the docker container has its own node modules.
|
||||||
# Therefore it is possible to have a different node version on the host machine
|
# Therefore it is possible to have a different node version on the host machine
|
||||||
@ -18,6 +18,25 @@ services:
|
|||||||
# bind the local folder to the docker to allow live reload
|
# bind the local folder to the docker to allow live reload
|
||||||
- ./:/server
|
- ./:/server
|
||||||
|
|
||||||
|
#######################################################
|
||||||
|
# DOCUMENTATION #######################################
|
||||||
|
#######################################################
|
||||||
|
documentation:
|
||||||
|
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
|
||||||
|
image: it4c/backend:local-documentation
|
||||||
|
build:
|
||||||
|
target: documentation
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
volumes:
|
||||||
|
# This makes sure the docker container has its own node modules.
|
||||||
|
# Therefore it is possible to have a different node version on the host machine
|
||||||
|
- documentation_node_modules:/app/node_modules
|
||||||
|
# bind the local folder to the docker to allow live reload
|
||||||
|
- ./:/app
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
backend_node_modules:
|
backend_node_modules:
|
||||||
documentation_node_modules:
|
documentation_node_modules:
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
# This file defines the production settings. It is overwritten by docker-compose.override.yml,
|
|
||||||
# which defines the development settings. The override.yml is loaded by default. Therefore it
|
|
||||||
# is required to explicitly define if you want an production build:
|
|
||||||
# > docker-compose -f docker-compose.yml up
|
|
||||||
version: '3.4'
|
version: '3.4'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
#######################################################
|
||||||
|
# BACKEND #############################################
|
||||||
|
#######################################################
|
||||||
backend:
|
backend:
|
||||||
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
|
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
|
||||||
image: it4c/backend:local-production
|
image: it4c/backend:local-production
|
||||||
@ -22,10 +22,7 @@ services:
|
|||||||
# - BUILD_DATE="1970-01-01T00:00:00.00Z"
|
# - BUILD_DATE="1970-01-01T00:00:00.00Z"
|
||||||
# - BUILD_VERSION="0.0.0.0"
|
# - BUILD_VERSION="0.0.0.0"
|
||||||
# - BUILD_COMMIT="0000000"
|
# - BUILD_COMMIT="0000000"
|
||||||
- NODE_ENV="production"
|
- NODE_ENV=production
|
||||||
# env_file:
|
|
||||||
# - ./.env
|
|
||||||
# - ./backend/.env
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
external-net:
|
external-net:
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
|
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
|
||||||
}
|
}
|
||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user