Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ahadley1124 committed Dec 18, 2023
2 parents b554af5 + 0889ba3 commit f882b53
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 8 deletions.
39 changes: 39 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/engine/reference/builder/#dockerignore-file

**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.next
**/.cache
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/build
**/dist
LICENSE
README.md

.env*
.flaskenv*
!.env.project
!.env.vault
12 changes: 6 additions & 6 deletions .env.vault
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
#/--------------------------------------------------/

# ci
DOTENV_VAULT_CI="2bX+CD+Bjpkl3W729jJnIZ/YBbZjxbN853o/tawAq0JUXI01FYsvdi+IL0iaGmqwsUmm/oqw2xcUTB+NpPnAEhiZ/I1bRkH7MmH9kshGuTksHpcsQM7A4sp02M/a"
DOTENV_VAULT_CI_VERSION=3
DOTENV_VAULT_CI="/BCBhdP6d9ZWi4XPdLAXINnaSL+5rISKQ7ylgyCQtzWsaPfuVqIR8UE0+8JA4VJ5NSltqOGL/LfyUp5rIaquPGHhbzPaLVSt+mrRlTaajA3Tid4f/Ssg3nj4wvi1oLYLw5MMGVy8BMNECVtOYQ=="
DOTENV_VAULT_CI_VERSION=4

# staging
DOTENV_VAULT_STAGING="4k+3Zt84qkxiIkVq6PQ+GcgCgMromjLnqnEGxRI7n7yoRE9SPvPP14UXUIYyRXvRCZYsq4CTD1Xc6j747GkDNZyzbB4GhtOye/3iHof4NSpd12WE48qOF/niitgQ"
DOTENV_VAULT_STAGING_VERSION=3
DOTENV_VAULT_STAGING="9dA47NyTsyVGTaDoTf57VIP1ErCdUZTQhilEuabPmN/rj7s0IxTZTIJOA/57Saf6d2fULfKv3i93d86nbKArxYtCzq007m1Eg7d0JrexP4QL8KFBwZju2TYsGE/UBf7nn90xy27QBBDQ0Intig=="
DOTENV_VAULT_STAGING_VERSION=4

# production
DOTENV_VAULT_PRODUCTION="/WxJQFLrTTuI7DnV9n3qZRssi5lE1jHo8MI3iwuB1jLEfa9LkbqiFjsBiCOuUyy5UHLS7hO7D3Abbt/Koj7qiBo8Y+cs33uNTHUYzSQ+D5DzAAmNr9xftXIqDZ7h"
DOTENV_VAULT_PRODUCTION_VERSION=3
DOTENV_VAULT_PRODUCTION="mgIroTxu6orEQ7xvLxH1dFDnld/wB2dNvjgMR1OeGbDI4vj9CJXr3QXbVh77KY0XBTXLRKGXXjWNzs90ssPk0Os3gpo5gCZz5V9SyHbkZcXUM1kuJcUcHA9KxUJGm+tw11nM1sUOQUxDs3XFXg=="
DOTENV_VAULT_PRODUCTION_VERSION=4

# development
DOTENV_VAULT_DEVELOPMENT="SBZnUK9ZOEELq7QFYn4QEtPsxYvoZ9OcFHS41l2xSC4dXD8bkIrGuJOdIiUqnqPg0kgmclmhbtaS0wLaZ9b+ZwDFv9DKReB8+DR3g7l2fdYM1t+J48qkApYL+ADfkKQ7bXAJmvGd2Q1B3WTgWRGh7qJeWuENPn173BTUaXssNQzz1DxlFul6x8HBKSYRz3MSqjsXeG7LAs4wzPhyy4JXeHZQLhLzV/3azL+0is+4gnHihbBmG6tFNg6CFif2RUEVFLsfpotzcp1FXy6uMzB8asVKstCPq3GFyj+0Pv9tlQDXlfAAhocasvlTvpis0KHsPc8nS2OMGCoc4hEaQoxtZ9SfrhOT/fTm14fRnyxv2o+b9Bap8mKMIlK2L9GBPpi/xYyH98dnCLZHgnDXbEQimIH8GQzwjgwVIpFjRwoXFzHRV9RgKJPGcNbFEtZvKQjlw2aD1zp/NQ1+2Uf5dtNI0nAaqzM="
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Deploy to Server

on:
push:
branches: 'master'
workflow_dispatch:

jobs:
build_api:
runs-on: self-hosted
steps:
- name: Setup
uses: actions/checkout@v4
- name: Deploy
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
QRZ_USER: ${{ secrets.QRZ_USER }}
QRZ_PASS: ${{ secrets.QRZ_PASS }}
run: docker compose up --build -d

37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# syntax=docker/dockerfile:1

# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/engine/reference/builder/

ARG NODE_VERSION=20.5.1

FROM node:${NODE_VERSION}-alpine

# Use production node environment by default.
ENV NODE_ENV production

WORKDIR /usr/src/app

COPY . .

# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a cache mount to /root/.yarn to speed up subsequent builds.
# Leverage a bind mounts to package.json and yarn.lock to avoid having to copy them into
# into this layer.
RUN yarn install --production

# Install typescript
RUN npm i -g typescript

# Compile
RUN tsc -p ./tsconfig.json

# Run the application as a non-root user.
USER node

# Expose the port that the application listens on.
EXPOSE 4500

# Run the application.
CMD node ./build/index.js
22 changes: 22 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Docker compose reference guide at
# https://docs.docker.com/compose/compose-file/

# Here the instructions define your application as a service called "server".
# This service is built from the Dockerfile in the current directory.
# You can add other services your application may depend on here, such as a
# database or a cache. For examples, see the Awesome Compose repository:
# https://github.com/docker/awesome-compose
services:
server:
build:
context: .
environment:
NODE_ENV: production
SUPABASE_URL: ${SUPABASE_URL}
SUPABASE_KEY: ${SUPABASE_KEY}
QRZ_USER: ${QRZ_USER}
QRZ_PASS: ${QRZ_PASS}
ports:
- 4500:4500
restart: unless-stopped
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ app.get('/qso/:callsign', async (req, res) => {
res.status(200).send(data);
});

app.listen(4000, () => {
console.log('Server is running on port 4000');
app.listen(4500, () => {
console.log('Server is running on port 4500');
})

0 comments on commit f882b53

Please sign in to comment.