mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 01:46:07 +00:00
fix docker
This commit is contained in:
parent
79e726835f
commit
cd739f56f5
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
**/node_modules
|
||||
**/build
|
||||
**/coverage
|
||||
2
.github/workflows/test_admin_interface.yml
vendored
2
.github/workflows/test_admin_interface.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Admin Interface | Build 'test' image
|
||||
run: docker build --target test -t "gradido/admin:test" admin/ --build-arg NODE_ENV="test"
|
||||
run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --no-deps admin
|
||||
|
||||
unit_test:
|
||||
if: needs.files-changed.outputs.admin == 'true'
|
||||
|
||||
@ -42,6 +42,8 @@ EXPOSE ${PORT}
|
||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||
WORKDIR ${DOCKER_WORKDIR}
|
||||
|
||||
RUN mkdir -p /config
|
||||
|
||||
##################################################################################
|
||||
# DEVELOPMENT (Connected to the local environment, to reload on demand) ##########
|
||||
##################################################################################
|
||||
@ -53,7 +55,7 @@ FROM base as development
|
||||
# Run command
|
||||
# (for development we need to execute yarn install since the
|
||||
# node_modules are on another volume and need updating)
|
||||
CMD /bin/sh -c "yarn install && yarn run dev"
|
||||
CMD /bin/sh -c "cd /config && yarn install && yarn build && cd /app && yarn install && yarn run dev"
|
||||
|
||||
##################################################################################
|
||||
# BUILD (Does contain all files and is therefore bloated) ########################
|
||||
@ -61,9 +63,15 @@ CMD /bin/sh -c "yarn install && yarn run dev"
|
||||
FROM base as build
|
||||
|
||||
# Copy everything
|
||||
COPY . .
|
||||
# yarn install
|
||||
COPY ./admin/ .
|
||||
# Copy everything from config
|
||||
COPY ./config/ ../config/
|
||||
|
||||
# yarn install admin
|
||||
RUN yarn install --production=false --frozen-lockfile --non-interactive
|
||||
# yarn install config
|
||||
RUN cd ../config && yarn install --production=false --frozen-lockfile --non-interactive
|
||||
RUN cd ../config && yarn build
|
||||
# yarn build
|
||||
RUN yarn run build
|
||||
|
||||
@ -85,6 +93,7 @@ FROM base as production
|
||||
|
||||
# Copy "binary"-files from build image
|
||||
COPY --from=build ${DOCKER_WORKDIR}/build ./build
|
||||
COPY --from=build ${DOCKER_WORKDIR}/../config/build ../config/build
|
||||
# We also copy the node_modules express and serve-static for the run script
|
||||
COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules
|
||||
# Copy static files
|
||||
|
||||
14
config/.gitignore
vendored
Normal file
14
config/.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
node_modules/
|
||||
build/
|
||||
.cache/
|
||||
.yarn/install-state.gz
|
||||
|
||||
/.env
|
||||
/.env.bak
|
||||
|
||||
# coverage folder
|
||||
coverage/
|
||||
|
||||
# emacs
|
||||
*~
|
||||
|
||||
@ -7,7 +7,7 @@ services:
|
||||
build:
|
||||
target: test
|
||||
environment:
|
||||
- NODE_ENV="test"
|
||||
- NODE_ENV=test
|
||||
|
||||
########################################################
|
||||
# ADMIN INTERFACE ######################################
|
||||
@ -17,7 +17,7 @@ services:
|
||||
build:
|
||||
target: test
|
||||
environment:
|
||||
- NODE_ENV="test"
|
||||
- NODE_ENV=test
|
||||
|
||||
########################################################
|
||||
# BACKEND ##############################################
|
||||
@ -31,7 +31,7 @@ services:
|
||||
- external-net
|
||||
- internal-net
|
||||
environment:
|
||||
- NODE_ENV="test"
|
||||
- NODE_ENV=test
|
||||
- DB_HOST=mariadb
|
||||
|
||||
########################################################
|
||||
@ -46,7 +46,7 @@ services:
|
||||
- external-net
|
||||
- internal-net
|
||||
environment:
|
||||
- NODE_ENV="test"
|
||||
- NODE_ENV="test
|
||||
- DB_HOST=mariadb
|
||||
|
||||
########################################################
|
||||
@ -61,7 +61,7 @@ services:
|
||||
- external-net
|
||||
- internal-net
|
||||
environment:
|
||||
- NODE_ENV="test"
|
||||
- NODE_ENV=test
|
||||
- DB_HOST=mariadb
|
||||
|
||||
########################################################
|
||||
@ -73,7 +73,7 @@ services:
|
||||
context: ./database
|
||||
target: test_up
|
||||
environment:
|
||||
- NODE_ENV="test"
|
||||
- NODE_ENV=test
|
||||
# restart: always # this is very dangerous, but worth a test for the delayed mariadb startup at first run
|
||||
|
||||
########################################################
|
||||
@ -85,7 +85,7 @@ services:
|
||||
context: ./dlt-database
|
||||
target: test_up
|
||||
environment:
|
||||
- NODE_ENV="test"
|
||||
- NODE_ENV=test
|
||||
# restart: always # this is very dangerous, but worth a test for the delayed mariadb startup at first run
|
||||
|
||||
#########################################################
|
||||
|
||||
@ -12,7 +12,8 @@ services:
|
||||
# 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: gradido/frontend:local-production
|
||||
build:
|
||||
context: ./frontend
|
||||
context: ./
|
||||
dockerfile: ./frontend/Dockerfile
|
||||
target: production
|
||||
networks:
|
||||
- external-net
|
||||
@ -40,7 +41,8 @@ services:
|
||||
# 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: gradido/admin:local-production
|
||||
build:
|
||||
context: ./admin
|
||||
context: ./
|
||||
dockerfile: ./admin/Dockerfile
|
||||
target: production
|
||||
networks:
|
||||
- external-net
|
||||
|
||||
@ -42,6 +42,8 @@ EXPOSE ${PORT}
|
||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||
WORKDIR ${DOCKER_WORKDIR}
|
||||
|
||||
RUN mkdir -p /config
|
||||
|
||||
##################################################################################
|
||||
# DEVELOPMENT (Connected to the local environment, to reload on demand) ##########
|
||||
##################################################################################
|
||||
@ -53,7 +55,7 @@ FROM base as development
|
||||
# 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 "yarn install && yarn run dev"
|
||||
CMD /bin/sh -c "cd /config && yarn install && yarn build && cd /app && yarn install && yarn run dev"
|
||||
|
||||
##################################################################################
|
||||
# BUILD (Does contain all files and is therefore bloated) ########################
|
||||
@ -61,9 +63,17 @@ CMD /bin/sh -c "yarn install && yarn run dev"
|
||||
FROM base as build
|
||||
|
||||
# Copy everything
|
||||
COPY . .
|
||||
COPY ./frontend ./
|
||||
|
||||
# Copy everything from config
|
||||
COPY ./config/ ../config/
|
||||
|
||||
# npm install
|
||||
RUN yarn global add node-gyp && yarn install --production=false --frozen-lockfile --non-interactive
|
||||
|
||||
# install and build config
|
||||
RUN cd ../config && yarn install --production=false --frozen-lockfile --non-interactive
|
||||
RUN cd ../config && yarn build
|
||||
# npm build
|
||||
RUN yarn run build
|
||||
|
||||
@ -85,6 +95,7 @@ FROM base as production
|
||||
|
||||
# Copy "binary"-files from build image
|
||||
COPY --from=build ${DOCKER_WORKDIR}/build ./build
|
||||
COPY --from=build ${DOCKER_WORKDIR}/../config/build ../config/build
|
||||
# We also copy the node_modules express and serve-static for the run script
|
||||
COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules
|
||||
# Copy static files
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user