-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from Rocketseat/chore/docker-compose-environme…
…nt-variables chore: set environment variables
- Loading branch information
Showing
6 changed files
with
51 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,33 @@ | ||
# App | ||
APP_PORT=3333 | ||
APP_NAME=backend-template | ||
APP_VERSION='0.0.1' | ||
|
||
JWT_SECRET_KEY='JWT_SECRET_KEY' | ||
JWT_PUBLIC_KEY='JWT_PUBLIC_KEY' | ||
|
||
# Database | ||
DATABASE_HOST=localhost | ||
DATABASE_PORT=3306 | ||
DATABASE_USER=root | ||
DATABASE_PASS=toor | ||
DATABASE_NAME=app | ||
DATAVASE_ROOT_PASSWORD=toor | ||
|
||
DATABASE_URL="mysql://${DATABASE_USER}:${DATABASE_PASS}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}" | ||
|
||
JWT_SECRET_KEY='JWT_SECRET_KEY' | ||
JWT_PUBLIC_KEY='JWT_PUBLIC_KEY' | ||
# Redis | ||
REDIS_HOST=localhost | ||
REDIS_PORT=6379 | ||
REDIS_PASSWORD= | ||
|
||
# kafka | ||
KAFKA_HOST=localhost | ||
KAFKA_PORT=9092 | ||
KAFKA_USER= | ||
KAFKA_PASSWORD= | ||
KAFKA_BROKERS= | ||
|
||
# Zookeeper | ||
ZOOKEEPER_HOST=localhost | ||
ZOOKEEPER_PORT=2181 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,14 +38,14 @@ COPY --from=build /var/app/prisma prisma/ | |
RUN wget -O /var/app/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 && \ | ||
chmod -v +x /var/app/dumb-init | ||
RUN npx prisma generate | ||
RUN npx [email protected] . -o $SERVICE_NAME | ||
RUN chmod -v +x /var/app/$SERVICE_NAME | ||
RUN npx [email protected] . -o $APP_NAME | ||
RUN chmod -v +x /var/app/$APP_NAME | ||
|
||
FROM node:16-alpine AS runtime | ||
ARG DATABASE_URL | ||
ENV DATABASE_URL $DATABASE_URL | ||
ARG VERSION="0.0.1" | ||
ENV VERSION $VERSION | ||
ARG APP_VERSION="0.0.1" | ||
ENV APP_VERSION $APP_VERSION | ||
ARG COMMIT | ||
ENV COMMIT $COMMIT | ||
ENV NODE_ENV production | ||
|
@@ -56,6 +56,6 @@ COPY --chown=node:node --from=package /var/app/src /src/ | |
COPY --chown=node:node --from=package /var/app/src src/ | ||
# :) | ||
COPY --chown=node:node --from=package /var/app/dumb-init dumb-init | ||
COPY --chown=node:node --from=package /var/app/$SERVICE_NAME $SERVICE_NAME | ||
COPY --chown=node:node --from=package /var/app/$APP_NAME $APP_NAME | ||
ENTRYPOINT ["/var/app/dumb-init", "--"] | ||
CMD ["/var/app/$SERVICE_NAME"] | ||
CMD ["/var/app/$APP_NAME"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import 'dotenv/config'; | ||
|
||
export const PORT = process.env.PORT ?? 3333; | ||
export const PORT = process.env.APP_PORT ?? 3333; | ||
export const ENV = process.env.NODE_ENV ?? 'development'; | ||
export const SERVICE = process.env.SERVICE ?? 'backend-template'; | ||
export const VERSION = process.env.VERSION ?? '1.0.0'; | ||
export const APP_NAME = process.env.APP_NAME ?? 'backend-template'; | ||
export const APP_VERSION = process.env.APP_VERSION ?? '1.0.0'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters