Compare commits

..

2 Commits

Author SHA1 Message Date
7adfc6aa1d
Add docker-compose
All checks were successful
Build & publish images / build-and-push-image (push) Successful in 24s
2023-06-19 07:41:58 +00:00
b8b71481c6
Add Docker builds
All checks were successful
Build & publish images / build-and-push-image (push) Successful in 6m11s
2023-06-19 06:50:05 +00:00
7 changed files with 126 additions and 25 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
npm-debug.log

View File

@ -0,0 +1,44 @@
name: Build & publish images
on: [push]
env:
REGISTRY: git.plantroon.com
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
- name: Extract Docker metadata
id: meta
uses: https://github.com/docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: git.plantroon.com/aux/keyserver
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM node:16
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 3000
CMD [ "node", "index.js" ]

26
docker-compose.yml Normal file
View File

@ -0,0 +1,26 @@
version: '3'
services:
mongodb:
image: mongo
volumes:
- ./data/db:/data/db
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
networks:
- backend
env_file:
- env.sample
keyserver:
image: git.plantroon.com/aux/keyserver:master
ports:
- "12345:3000"
depends_on:
- mongodb
networks:
- backend
env_file:
- env.sample
networks:
backend:

30
env.sample Normal file
View File

@ -0,0 +1,30 @@
NODE_ENV=production
LOG_LEVEL=debug
PORT=3000
PAPERTRAIL_HOST=''
PAPERTRAIL_PORT=''
MONGO_URI=mongodb:27017/keyserver_db
MONGO_USER=keyserver
MONGO_PASS=changeme
MONGO_INITDB_ROOT_USERNAME=keyserver
MONGO_INITDB_ROOT_PASSWORD=changeme
MONGO_INITDB_DATABASE=keyserver_db
SENDER_NAME=keyserver
SENDER_EMAIL=changeme
SMTP_HOST=changeme
SMTP_PORT=587
SMTP_TLS=false
SMTP_STARTTLS=true
SMTP_PGP=''
SMTP_USER=''
SMTP_PASS=''
HTTPS_UPGRADE=true
HTTPS_KEY_PIN=''
HTTPS_KEY_PIN_BACKUP=''
PUBLIC_KEY_PURGE_TIME=30

12
mongo-init.js Normal file
View File

@ -0,0 +1,12 @@
db.createUser(
{
user: process.env.MONGO_INITDB_ROOT_USERNAME,
pwd: process.env.MONGO_INITDB_ROOT_PASSWORD,
roles: [
{
role: "readWrite",
db: process.env.MONGO_INITDB_DATABASE
}
]
}
);

28
package-lock.json generated
View File

@ -1812,12 +1812,9 @@
} }
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.7", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
"requires": {
"whatwg-url": "^5.0.0"
}
}, },
"node-localstorage": { "node-localstorage": {
"version": "1.3.1", "version": "1.3.1",
@ -2466,11 +2463,6 @@
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
}, },
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"triple-beam": { "triple-beam": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
@ -2541,20 +2533,6 @@
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
}, },
"webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"requires": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"which": { "which": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",