fix docker setup

This commit is contained in:
einhornimmond 2025-01-20 17:00:51 +01:00
parent 7295bfc5af
commit 7fafb546b5
7 changed files with 57 additions and 9 deletions

View File

@ -114,7 +114,7 @@ describe('NavBar', () => {
it('changes window location to wallet and dispatches logout', async () => {
const dispatchSpy = vi.spyOn(store, 'dispatch')
await wrapper.vm.handleWallet()
expect(window.location).toBe(CONFIG.WALLET_AUTH_URL.replace('{token}', 'valid-token'))
expect(window.location).toBe(CONFIG.WALLET_AUTH_URL + 'valid-token')
expect(dispatchSpy).toHaveBeenCalledWith('logout')
})
})

View File

@ -80,7 +80,7 @@ const handleLogout = async () => {
}
const handleWallet = () => {
window.location = CONFIG.WALLET_AUTH_URL.replace('{token}', store.state.token)
window.location = CONFIG.WALLET_AUTH_URL + store.state.token
store.dispatch('logout') // logout without redirect
}

View File

@ -43,6 +43,7 @@ RUN mkdir -p ${DOCKER_WORKDIR}
WORKDIR ${DOCKER_WORKDIR}
RUN mkdir -p /database
RUN mkdir -p /config
##################################################################################
# DEVELOPMENT (Connected to the local environment, to reload on demand) ##########
@ -55,7 +56,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 "cd /database && yarn install && yarn build && cd /app && yarn install && yarn run dev"
CMD /bin/sh -c "cd /config && yarn install && yarn build && cd /database && yarn install && yarn build && cd /app && yarn install && yarn run dev"
##################################################################################
# BUILD (Does contain all files and is therefore bloated) ########################
@ -66,6 +67,8 @@ FROM base as build
COPY ./backend/ ./
# Copy everything from database
COPY ./database/ ../database/
# Copy everything from config
COPY ./config/ ../config/
# yarn install backend
RUN yarn install --production=false --frozen-lockfile --non-interactive
@ -73,11 +76,17 @@ RUN yarn install --production=false --frozen-lockfile --non-interactive
# yarn install database
RUN cd ../database && yarn install --production=false --frozen-lockfile --non-interactive
# yarn install config
RUN cd ../config && yarn install --production=false --frozen-lockfile --non-interactive
# yarn build
RUN yarn run build
RUN yarn build
# yarn build database
RUN cd ../database && yarn run build
RUN cd ../database && yarn build
# yarn build config
RUN cd ../config && yarn build
##################################################################################
# TEST ###########################################################################
@ -95,9 +104,11 @@ FROM base as production
# Copy "binary"-files from build image
COPY --from=build ${DOCKER_WORKDIR}/build ./build
COPY --from=build ${DOCKER_WORKDIR}/../database/build ../database/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 --from=build ${DOCKER_WORKDIR}/../database/node_modules ../database/node_modules
COPY --from=build ${DOCKER_WORKDIR}/../config/node_modules ../config/node_modules
# Copy static files
# COPY --from=build ${DOCKER_WORKDIR}/public ./public

View File

@ -5,8 +5,8 @@ import fs from 'fs'
const DB_VERSION_PATTERN = /^(\d{4}-[a-z0-9-_]+)/
// Define the paths to check
const migrationsDir = path.join(__dirname, '..', '..', '..', 'migrations')
const entitiesDir = path.join(__dirname, '..', '..', '..', 'entity')
const migrationsDir = path.join(__dirname, '..', '..', 'migrations')
const entitiesDir = path.join(__dirname, '..', '..', 'entity')
// Helper function to get the highest version number from the directory
function getLatestDbVersion(dir: string): string {

View File

@ -47,6 +47,7 @@ RUN mkdir -p ${DOCKER_WORKDIR}
WORKDIR ${DOCKER_WORKDIR}
RUN mkdir -p /database
RUN mkdir -p /config
##################################################################################
# DEVELOPMENT (Connected to the local environment, to reload on demand) ##########
@ -59,7 +60,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 "cd /database && yarn install && yarn build && cd /app && yarn install && yarn run dev"
CMD /bin/sh -c "cd /config && yarn install && yarn build && cd /database && yarn install && yarn build && cd /app && yarn install && yarn run dev"
##################################################################################
# BUILD (Does contain all files and is therefore bloated) ########################
@ -70,6 +71,8 @@ FROM base as build
COPY ./dht-node/ ./
# Copy everything from database
COPY ./database/ ../database/
# Copy everything from config
COPY ./config/ ../config/
# yarn install dht-node
RUN yarn install --production=false --frozen-lockfile --non-interactive
@ -77,12 +80,18 @@ RUN yarn install --production=false --frozen-lockfile --non-interactive
# yarn install database
RUN cd ../database && yarn install --production=false --frozen-lockfile --non-interactive
# yarn install config
RUN cd ../config && yarn install --production=false --frozen-lockfile --non-interactive
# yarn build
RUN yarn run build
# yarn build database
RUN cd ../database && yarn run build
# yarn build config
RUN cd ../config && yarn run build
##################################################################################
# TEST ###########################################################################
##################################################################################
@ -99,9 +108,11 @@ FROM base as production
# Copy "binary"-files from build image
COPY --from=build ${DOCKER_WORKDIR}/build ./build
COPY --from=build ${DOCKER_WORKDIR}/../database/build ../database/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 --from=build ${DOCKER_WORKDIR}/../database/node_modules ../database/node_modules
COPY --from=build ${DOCKER_WORKDIR}/../config/node_modules ../config/node_modules
# Copy static files
# COPY --from=build ${DOCKER_WORKDIR}/public ./public

View File

@ -55,9 +55,12 @@ services:
- backend_node_modules:/app/node_modules
- backend_database_node_modules:/database/node_modules
- backend_database_build:/database/build
- backend_config_node_modules:/config/node_modules
- backend_config_build:/config/build
# bind the local folder to the docker to allow live reload
- ./backend:/app
- ./database:/database
- ./config:/config
########################################################
# DHT-NODE #############################################
@ -78,9 +81,12 @@ services:
- dht_node_modules:/app/node_modules
- dht_database_node_modules:/database/node_modules
- dht_database_build:/database/build
- dht_config_node_modules:/config/node_modules
- dht_config_build:/config/build
# bind the local folder to the docker to allow live reload
- ./dht-node:/app
- ./database:/database
- ./config:/config
########################################################
# DLT-CONNECTOR ########################################
@ -122,9 +128,12 @@ services:
- federation_node_modules:/app/node_modules
- federation_database_node_modules:/database/node_modules
- federation_database_build:/database/build
- federation_config_node_modules:/config/node_modules
- federation_config_build:/config/build
# bind the local folder to the docker to allow live reload
- ./federation:/app
- ./database:/database
- ./config:/config
########################################################
# DATABASE ##############################################
@ -216,13 +225,19 @@ volumes:
backend_node_modules:
backend_database_node_modules:
backend_database_build:
backend_config_node_modules:
backend_config_build:
dht_node_modules:
dht_database_node_modules:
dht_database_build:
dht_config_node_modules:
dht_config_build:
dlt_connector_modules:
federation_node_modules:
federation_database_node_modules:
federation_database_build:
federation_config_node_modules:
federation_config_build:
database_node_modules:
database_build:
dlt-database_node_modules:

View File

@ -44,6 +44,7 @@ RUN mkdir -p ${DOCKER_WORKDIR}
WORKDIR ${DOCKER_WORKDIR}
RUN mkdir -p /database
RUN mkdir -p /config
##################################################################################
# DEVELOPMENT (Connected to the local environment, to reload on demand) ##########
@ -56,7 +57,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 "cd /database && yarn install && yarn build && cd /app && yarn install && yarn run dev"
CMD /bin/sh -c "cd /config && yarn install && yarn build && cd /database && yarn install && yarn build && cd /app && yarn install && yarn run dev"
##################################################################################
# BUILD (Does contain all files and is therefore bloated) ########################
@ -67,6 +68,8 @@ FROM base as build
COPY ./federation/ ./
# Copy everything from database
COPY ./database/ ../database/
# Copy everything from config
COPY ./config/ ../config/
# yarn install federation
RUN yarn install --production=false --frozen-lockfile --non-interactive
@ -74,12 +77,18 @@ RUN yarn install --production=false --frozen-lockfile --non-interactive
# yarn install database
RUN cd ../database && yarn install --production=false --frozen-lockfile --non-interactive
# yarn install config
RUN cd ../config && yarn install --production=false --frozen-lockfile --non-interactive
# yarn build
RUN yarn run build
# yarn build database
RUN cd ../database && yarn run build
# yarn build config
RUN cd ../config && yarn run build
##################################################################################
# TEST ###########################################################################
##################################################################################
@ -96,9 +105,11 @@ FROM base as production
# Copy "binary"-files from build image
COPY --from=build ${DOCKER_WORKDIR}/build ./build
COPY --from=build ${DOCKER_WORKDIR}/../database/build ../database/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 --from=build ${DOCKER_WORKDIR}/../database/node_modules ../database/node_modules
COPY --from=build ${DOCKER_WORKDIR}/../config/node_modules ../config/node_modules
# Copy static files
# COPY --from=build ${DOCKER_WORKDIR}/public ./public