-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from dreammall-earth/docker-compose
feat(docker): docker-compose on top level integrated for all services
- Loading branch information
Showing
11 changed files
with
393 additions
and
32 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
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,52 @@ | ||
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 | ||
env: | ||
WORKING_DIRECTORY: ./backend | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Backend | Build Docker Production | ||
run: docker compose -f docker-compose.yml build | ||
working-directory: ${{env.WORKING_DIRECTORY}} | ||
|
||
build-development: | ||
if: needs.files-changed.outputs.changes == 'true' | ||
name: Build Docker Development - Backend | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./backend | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Backend | Build Docker Development | ||
run: docker compose build | ||
working-directory: ${{env.WORKING_DIRECTORY}} |
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
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,52 @@ | ||
name: "presenter: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 - presenter-test-build-docker | ||
runs-on: ubuntu-latest | ||
outputs: | ||
changes: ${{ steps.changes.outputs.presenter-test-build-docker }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Check for presenter 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 - Presenter | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./presenter | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Presenter | Build Docker Production | ||
run: docker compose -f docker-compose.yml build | ||
working-directory: ${{env.WORKING_DIRECTORY}} | ||
|
||
build-development: | ||
if: needs.files-changed.outputs.changes == 'true' | ||
name: Build Docker Development - Presenter | ||
needs: files-changed | ||
runs-on: ubuntu-latest | ||
env: | ||
WORKING_DIRECTORY: ./presenter | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Presenter | Build Docker Development | ||
run: docker compose build | ||
working-directory: ${{env.WORKING_DIRECTORY}} |
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,53 @@ | ||
FROM node:21-alpine3.17 as base | ||
|
||
# ENVs (available in production aswell, can be overwritten by commandline or env file) | ||
## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame | ||
ENV DOCKER_WORKDIR="/app" | ||
## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 | ||
ENV BUILD_DATE="1970-01-01T00:00:00.00Z" | ||
## We cannot do $(npm run version).${BUILD_NUMBER} here so we default to 0.0.0.0 | ||
ENV BUILD_VERSION="0.0.0.0" | ||
## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 | ||
ENV BUILD_COMMIT="0000000" | ||
## SET NODE_ENV | ||
ENV NODE_ENV="production" | ||
## App relevant Envs | ||
ENV PORT="3000" | ||
|
||
# Labels | ||
LABEL org.label-schema.build-date="${BUILD_DATE}" | ||
LABEL org.label-schema.name="dreammall" | ||
LABEL org.label-schema.description="DreamMall" | ||
LABEL org.label-schema.usage="https://github.com/dreammall-earth/dreammall.earth/blob/master/README.md" | ||
LABEL org.label-schema.url="https://github.com/dreammall-earth/dreammall.earth/" | ||
LABEL org.label-schema.vcs-url="https://github.com/dreammall-earth/dreammall.earth/tree/master/" | ||
LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" | ||
LABEL org.label-schema.vendor="DreamMall" | ||
LABEL org.label-schema.version="${BUILD_VERSION}" | ||
LABEL org.label-schema.schema-version="1.0" | ||
LABEL maintainer="info@it4c.dev" | ||
|
||
# Install Additional Software | ||
## install: node-gyp dependencies | ||
# RUN apk --no-cache add g++ make python3 | ||
|
||
# Settings | ||
## Expose Container Port | ||
EXPOSE ${PORT} | ||
|
||
## Workdir | ||
RUN mkdir -p ${DOCKER_WORKDIR} | ||
WORKDIR ${DOCKER_WORKDIR} | ||
|
||
################################################################################## | ||
# DOCUMENTATION ################################################################## | ||
################################################################################## | ||
FROM base as documentation | ||
|
||
# We don't need to copy or build anything since we gonna bind to the | ||
# local filesystem which will need a rebuild anyway | ||
|
||
# Run command | ||
# (for development we need to execute npm install since the | ||
# node_modules are on another volume and need updating) | ||
CMD /bin/sh -c "npm install && npm run docs:dev" |
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
Oops, something went wrong.