diff --git a/Dockerfile b/Dockerfile index 4ecb896b..253eb2d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,30 +3,6 @@ FROM node:20 as build WORKDIR /app -# Default arguments for environment variables -ARG DATABASE_TYPE=postgres -ARG DATABASE_USERNAME=postgres -ARG DATABASE_PASSWORD=postgres -ARG DATABASE_NAME=vckit -ARG DATABASE_HOST=localhost -ARG DATABASE_PORT=5432 -ARG DATABASE_ENCRYPTION_KEY=29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c -ARG PORT=3332 -ARG PROTOCOL=http -ARG API_DOMAIN=localhost:3332 - -# Set environment variables -ENV DATABASE_TYPE=${DATABASE_TYPE} -ENV DATABASE_USERNAME=${DATABASE_USERNAME} -ENV DATABASE_PASSWORD=${DATABASE_PASSWORD} -ENV DATABASE_NAME=${DATABASE_NAME} -ENV DATABASE_HOST=${DATABASE_HOST} -ENV DATABASE_PORT=${DATABASE_PORT} -ENV DATABASE_ENCRYPTION_KEY=${DATABASE_ENCRYPTION_KEY} -ENV PORT=${PORT} -ENV PROTOCOL=${PROTOCOL} -ENV API_DOMAIN=${API_DOMAIN} - # Copy necessary files COPY package.json . COPY pnpm-lock.yaml . @@ -144,11 +120,11 @@ COPY --from=build /app/packages/vc-api/package.json packages/vc-api/package.json COPY --from=build /app/packages/vc-api/src/vc-api-schemas/vc-api.yaml packages/vc-api/src/vc-api-schemas/vc-api.yaml # Add an entrypoint script to the image -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh +COPY entrypoint.sh . +RUN chmod +x entrypoint.sh # Specify the script to run on container start -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["./entrypoint.sh"] # Expose the port EXPOSE ${PORT} diff --git a/docker-compose.yaml b/docker-compose.yaml index e7a9cbac..8598bbfd 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -13,8 +13,8 @@ services: vckit-api: build: context: . - args: - DATABASE_HOST: db + env_file: + - local.env ports: - 3332:3332 depends_on: diff --git a/local.env b/local.env new file mode 100644 index 00000000..579060cb --- /dev/null +++ b/local.env @@ -0,0 +1,10 @@ +DATABASE_HOST=db +DATABASE_TYPE=postgres +DATABASE_USERNAME=postgres +DATABASE_PASSWORD=postgres +DATABASE_NAME=vckit +DATABASE_PORT=5432 +DATABASE_ENCRYPTION_KEY=29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c +PORT=3332 +PROTOCOL=http +API_DOMAIN=localhost:3332 \ No newline at end of file