-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add database and local development
Signed-off-by: tylerslaton <mtslaton1@gmail.com>
- Loading branch information
1 parent
a3106c7
commit 6ee1543
Showing
5 changed files
with
184 additions
and
17 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 |
---|---|---|
@@ -1,20 +1,18 @@ | ||
# Use an official Node.js runtime as the base image | ||
FROM node:14 | ||
# when editing and using docker compose, make sure | ||
# to run `docker compose build --no-cache` to rebuild | ||
# the image and not use the cache. | ||
|
||
# Set the working directory in the container to /app | ||
FROM node:20 as dev | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install the application dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code to the working directory | ||
ENV NUXT_PORT=3000 | ||
ENV NODE_ENV=development | ||
COPY . . | ||
|
||
# Make port 3000 available outside the container | ||
RUN yarn install | ||
EXPOSE 3000 | ||
CMD [ "yarn", "dev" ] | ||
|
||
# Define the command to run the application | ||
CMD [ "npm", "start" ] | ||
FROM node:20 as prod | ||
WORKDIR /app | ||
COPY --from=dev /app . | ||
RUN yarn build | ||
CMD [ "yarn", "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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
version: '3' | ||
services: | ||
app: | ||
build: . | ||
build: | ||
context: . | ||
target: dev | ||
ports: | ||
- "3000:3000" | ||
volumes: | ||
|
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,10 @@ | ||
import { Pool } from 'pg'; | ||
|
||
const pool = new Pool({ | ||
host: process.env.DB_HOST, | ||
user: process.env.DB_USER, | ||
password: process.env.DB_PASSWORD, | ||
database: process.env.DB_NAME, | ||
}); | ||
|
||
export const query = (text: string, params: any[]) => pool.query(text, params); | ||
Check failure on line 10 in lib/db.ts GitHub Actions / ci (ubuntu-latest, lts/*)
|
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