-
Notifications
You must be signed in to change notification settings - Fork 0
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 #133 from LEDBrain/feature/122-api
we are merging this because this would stay a WIP branch forever. To not have this issue we will be merging and creating new issues for new Endpoints
- Loading branch information
Showing
18 changed files
with
3,290 additions
and
220 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Build | ||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-project: | ||
if: "!contains(github.event.head_commit.message, 'skip ci')" | ||
runs-on: ubuntu-latest | ||
env: | ||
PG_USER: postgres | ||
PG_PW: supersecret | ||
PG_DB: community-service-test | ||
DATABASE_URL: postgres://postgres:supersecret@localhost:5432/community-service-test?schema=public | ||
|
||
services: | ||
postgres: | ||
image: postgres:14.2 | ||
env: | ||
POSTGRES_USER: ${ PG_USER } | ||
POSTGRES_PASSWORD: ${ PG_PW } | ||
POSTGRES_DB: ${ PG_DB } | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
steps: | ||
- name: Log Database URL | ||
run: echo "Database URL $DATABASE_URL; PG_USER $PG_USER; PG_PW $PG_PW; PG_DB $PG_DB" | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.x' | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Build | ||
run: npm run build | ||
- name: Run API tests | ||
run: npm run test:api |
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,5 +1,5 @@ | ||
node_modules | ||
.env | ||
*.env | ||
db/database.sqlite | ||
dist | ||
.idea |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
paths: ['src/api/tests'], | ||
reporter: ['console'], | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM node:16.13.1-alpine as build | ||
WORKDIR /usr/app | ||
COPY . . | ||
RUN npm install | ||
RUN npm run build | ||
|
||
FROM node:16.13.1-alpine as cleanup | ||
WORKDIR /usr/app | ||
COPY --from=build /usr/app/package*.json ./ | ||
COPY --from=build /usr/app/dist ./dist | ||
COPY --from=build /usr/app/prisma ./prisma | ||
RUN npm install --only=production | ||
|
||
FROM node:16.13.1-alpine | ||
WORKDIR /usr/app | ||
COPY --from=cleanup /usr/app ./ | ||
USER 1000 | ||
|
||
EXPOSE 3000 | ||
|
||
ENV DISCORD_TOKEN $DISCORD_TOKEN | ||
ENV DISCORD_CLIENT_ID $DISCORD_CLIENT_ID | ||
ENV DISCORD_DEV_GUILD_ID $DISCORD_DEV_GUILD_ID | ||
ENV DATABASE_URL $DATABASE_URL | ||
ENV PORT 3000 | ||
ENV HOST $HOSTNAME | ||
|
||
CMD npm run migrate:prod && npm run start |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: '3.7' | ||
|
||
services: | ||
postgres: | ||
image: postgres:14.2 | ||
env_file: | ||
- prod.env | ||
volumes: | ||
- ./data:/var/lib/postgresql/data | ||
|
||
community-service: | ||
build: . | ||
depends_on: | ||
- postgres | ||
ports: | ||
- '3000:3000' | ||
env_file: | ||
- prod.env |
Oops, something went wrong.