Skip to content

Commit

Permalink
Publish package
Browse files Browse the repository at this point in the history
  • Loading branch information
apricot13 committed Aug 25, 2023
1 parent 87d0f0f commit e2085df
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 78 deletions.
54 changes: 45 additions & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
Procfile
makefile

# git
.git
.gitattributes
.gitignore
.github

# docker
docker-compose.yml
docker-compose.*
Dockerfile
.dockerignore
environment/

# environment and secretsss
.env
.vscode

# Common
README.md
CHANGELOG.md

# logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/log/*
!/log/.keep

# tmp
/tmp/*
!/tmp/.keep
*.swp
*~
.DS_Store

# Dependencies and dependency managers
node_modules/
bundle/
tmp/
environment/
docker-compose*
Dockerfile
Procfile
makefile
.DS_Store
# Ignore yarn files
/yarn-error.log
yarn-debug.log*
.yarn-integrity

# ides
.idea
.vscode
28 changes: 28 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy Images to GHCR

# temporarily run on push for this branch
on: [push]
# on:
# push:
# branches:
# - main
# workflow_dispatch:

jobs:
push-store-image:
runs-on: ubuntu-latest
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@main

- name: "Login to GitHub Container Registry"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: "Build Inventory Image"
run: |
docker build . --tag ghcr.io/wearefuturegov/outpost-api-service:latest
docker push ghcr.io/wearefuturegov/outpost-api-service:latest
48 changes: 0 additions & 48 deletions docker-compose.development.yml

This file was deleted.

46 changes: 46 additions & 0 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: "3.7"
services:
outpost-api:
image: "outpost-api:production"
container_name: outpost-api
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
depends_on:
- mongo
build:
target: production
ports:
- 3001:3001
volumes:
- ./:/usr/src/app
environment:
NODE_ENV: production
DB_URI: mongodb://mongo:27017/outpost_api
networks:
- outpost_api_internal_network
- outpost_api_external_network

mongo:
image: mongo:6
container_name: outpost-api-mongo
restart: unless-stopped
ports:
- 27017:27017
volumes:
- outpost-api-mongo-volume:/data/db
- ./environment/containers/mongo/setup-mongodb-production.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
networks:
- outpost_api_external_network

volumes:
outpost-api-mongo-volume:

networks:
outpost_api_external_network:
outpost_api_internal_network:
internal: true
34 changes: 18 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
version: "3.7"
services:
outpost-api:
image: "outpost-api:production"
container_name: outpost-api
outpost-api-dev:
stdin_open: true
image: "outpost-api:development"
container_name: outpost-api-dev
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
Expand All @@ -13,34 +14,35 @@ services:
depends_on:
- mongo
build:
target: production
target: development
ports:
- 3001:3001
volumes:
- ./:/usr/src/app
- ./:/usr/src/app:cached
environment:
NODE_ENV: production
DB_URI: mongodb://mongo:27017/outpost_api
NODE_ENV: development
DB_URI: mongodb://mongo:27017/outpost_api_development
networks:
- outpost_api_internal_network
- outpost_api_external_network

- outpost_api_dev_external_network
- outpost_api_dev_internal_network
mongo:
image: mongo:6
container_name: outpost-api-mongo
restart: unless-stopped
ports:
- 27017:27017
volumes:
- outpost-api-mongo-volume:/data/db
- ./environment/containers/mongo/setup-mongodb-production.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
- outpost-api-dev-mongo-volume:/data/db
- ./environment/containers/mongo/setup-mongodb-development.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
environment:
MONGO_INITDB_DATABASE: outpost_api_development
networks:
- outpost_api_external_network
- outpost_api_dev_external_network

volumes:
outpost-api-mongo-volume:
outpost-api-dev-mongo-volume:

networks:
outpost_api_external_network:
outpost_api_internal_network:
outpost_api_dev_external_network:
outpost_api_dev_internal_network:
internal: true
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ To get up and running quickly with some data use docker compose.
git clone [email protected]:wearefuturegov/outpost-api-service.git && cd outpost-api-service

# build the image
docker compose -f docker-compose.development.yml build
docker compose build

# run the container
docker compose -f docker-compose.development.yml up -d
docker compose up -d

# open shell in container
docker compose -f docker-compose.development.yml exec outpost-api-dev /bin/ash;
docker compose exec outpost-api-dev /bin/ash;

# run the tests
docker compose -f docker-compose.development.yml exec outpost-api-dev npm run test
docker compose exec outpost-api-dev npm run test

# stop the container
docker compose -f docker-compose.development.yml stop
docker compose stop
```

If you want to use it in conjunction with a local mongodb database, for example you are using [Outpost](https://github.com/wearefuturegov/outpost/) you could also run it using just docker.
Expand Down

0 comments on commit e2085df

Please sign in to comment.