This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
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.
Signed-off-by: Stephan Renatus <[email protected]>
- Loading branch information
Showing
7 changed files
with
115 additions
and
15 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,8 @@ | ||
.git | ||
.gitignore | ||
Dockerfile | ||
.dockerignore | ||
dist | ||
node_modules | ||
.env | ||
README.md |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM node:lts-alpine AS builder | ||
USER node | ||
WORKDIR /opt/app | ||
COPY package*.json . | ||
RUN npm ci | ||
COPY --chown=node:node . . | ||
RUN npm run build && npm prune --omit=dev | ||
|
||
FROM node:lts-alpine | ||
|
||
ENV NODE_ENV production | ||
USER node | ||
WORKDIR /home/node | ||
|
||
COPY --from=builder --chown=node:node /opt/app/package*.json . | ||
COPY --from=builder --chown=node:node /opt/app/node_modules ./node_modules | ||
COPY --from=builder --chown=node:node /opt/app/dist ./dist | ||
|
||
# COPY package*.json . | ||
# COPY node_modules ./node_modules | ||
# COPY dist ./dist | ||
ARG PORT | ||
EXPOSE ${PORT:-3000} | ||
|
||
CMD ["node", "dist/main.js"] |
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,39 @@ | ||
services: | ||
server: | ||
build: . | ||
environment: | ||
- OPA_URL=http://opa:8181 | ||
depends_on: | ||
- opa | ||
expose: | ||
- 3000 | ||
|
||
opa: | ||
image: openpolicyagent/opa:latest | ||
ports: | ||
- '8181:8181' | ||
command: | ||
- run | ||
- --server | ||
- --addr=:8181 | ||
- --log-level=debug | ||
- --bundle | ||
- --disable-telemetry | ||
- /policies | ||
volumes: | ||
- ./policies:/policies | ||
|
||
integration-tests: | ||
image: ghcr.io/orange-opensource/hurl:latest | ||
volumes: | ||
- ./tests:/tests:rw | ||
entrypoint: sh | ||
command: | ||
- -c | ||
- 'hurl --test --retry=10 --verbose --report-junit=tests/api/report.xml /tests/api/*.hurl' | ||
environment: | ||
- HURL_host=server:3000 | ||
depends_on: | ||
- server | ||
profiles: | ||
- tools |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
POST http://{{host}}/auth/login | ||
Content-Type: application/json | ||
{"username": "maria", "password": "guess"} | ||
HTTP 201 | ||
[Captures] | ||
access_token: jsonpath "$['access_token']" | ||
|
||
POST http://{{host}}/cats | ||
Content-Type: application/json | ||
Authorization: Bearer {{access_token}} | ||
{"name": "garfield", "age": 5, "breed": "unknown"} | ||
HTTP 201 | ||
|
||
GET http://{{host}}/cats/garfield | ||
Content-Type: application/json | ||
Authorization: Bearer {{access_token}} | ||
x-user: stephan | ||
HTTP 200 | ||
{"name":"garfield","age":5,"breed":"unknown"} |
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 @@ | ||
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite tests="2" errors="0" failures="0"><testcase id="/tests/api/basic.hurl" name="/tests/api/basic.hurl" time="0.135" /><testcase id="/tests/api/cats.hurl" name="/tests/api/cats.hurl" time="0.018" /></testsuite></testsuites> |