Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update arguments and envs for the Dockerfile #194

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 3 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ services:
vckit-api:
build:
context: .
args:
DATABASE_HOST: db
env_file:
- local.env
ports:
- 3332:3332
depends_on:
Expand Down
10 changes: 10 additions & 0 deletions local.env
Original file line number Diff line number Diff line change
@@ -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
Loading