Skip to content

Commit

Permalink
[docker] Fix paths (#39)
Browse files Browse the repository at this point in the history
And add a .gitignore
  • Loading branch information
SerhatG authored Dec 20, 2023
1 parent f742bd7 commit 091ba3a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
6 changes: 6 additions & 0 deletions docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore generated theme
generated/*

# Ignore source code
*/*/source

8 changes: 3 additions & 5 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ cd "${SCRIPT_DIR}"
source ./include.functions.sh

# Set variables we will re-use multiple times
PROFILE_PATH="${GENERATED_DIRECTORY}/${CUSTOM_PROFILE_FILENAME}"
DOCKER_COMPOSE_ORIGINAL_PATH="${GENERATED_DIRECTORY}/docker-compose-original.yaml"

# Set variable with whether the custom profile file is found
[[ -f "${PROFILE_PATH}" ]] && PROFILE_PATH_FOUND=0 || PROFILE_PATH_FOUND=1

####################
### Validations ###
###################
Expand All @@ -27,6 +23,8 @@ if ! ( [[ -d "${GENERATED_DIRECTORY}" ]] || [[ -f "${DOCKER_COMPOSE_ORIGINAL_PAT
_error 'Generated directory not found. Use prepare.sh to generate one first.'
fi

: ${SFTP_READONLY_PASSWORD?'ENV variable SFTP_READONLY_PASSWORD is required if a database needs to be built'}

#####################
### The real deal ###
#####################
Expand Down Expand Up @@ -54,4 +52,4 @@ echo

# Build images
echo '# Building images'
_docker-compose -f "${DOCKER_COMPOSE_PATH}" --project-directory "${GENERATED_DIRECTORY}" build --pull --parallel
_docker-compose -f "${DOCKER_COMPOSE_PATH}" --project-directory "${GENERATED_DIRECTORY}" build --pull --parallel --build-arg SFTP_READONLY_PASSWORD="${SFTP_READONLY_PASSWORD}"
4 changes: 2 additions & 2 deletions docker/common/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ FROM maven:3-eclipse-temurin-17 as builder
WORKDIR /app

# First download as many dependencies as possible. This avoids downloading all dependencies each time something in source changes
COPY pom.xml /app
COPY source/pom.xml /app
RUN mvn clean package -Dmaven.main.skip -Dmaven.test.skip -Dspring-boot.repackage.skip && rm -r target

# Next do the actual build
COPY . /app
COPY source /app
RUN mvn clean package

# Move the resultant jar to a known name so it can be picked up by the final image.
Expand Down
7 changes: 4 additions & 3 deletions docker/common/database/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ ARG DATABASE_VERSION
# DBSOURCE_PATH should be the path containing our database source
# DATABASE_NAME will be the resulting database name
ENV DBDATA_PATH="/data_emission_service/db-data/aeriusII" \
DBCONFIG_PATH="/source/aerius-emission-database" \
DBSOURCE_PATH="/source/database" \
DBCONFIG_PATH="/source/database" \
DBRUNSCRIPT="docker" \
DBSOURCE_PATH="/source/aerius-emission-database" \
DBDATA_CLEANUP="false" \
DATABASE_NAME="emissions"

# Copy over the database source files
COPY source/ /source/aerius-emission-database
COPY source/ /source

# Start the actual database build
RUN --mount=id=aerius-dbdata,type=cache,target=/data_emission_service/db-data \
Expand Down
2 changes: 1 addition & 1 deletion docker/copy_dependencies_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi
# This service is build within docker, so move the source to the correct location
if _is_module_enabled "${1}" 'api'; then
cp -auv "${SOURCE_DIR}"/source/rest-service \
"${DOCKER_COMMON_DIR}"/api/
"${DOCKER_COMMON_DIR}"/api/source
fi

# Change current directory to previous one so scripts calling this one can function properly
Expand Down

0 comments on commit 091ba3a

Please sign in to comment.