Skip to content

Commit

Permalink
Configure standalone Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
blenderskool committed Nov 23, 2021
1 parent 0f3e3e5 commit cd2149f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.next
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DATABASE_URL="postgresql://username:password@localhost:5432/database"
REDIS_URL="redis://localhost:6379"

SECRETS_KEY="AES256-32-bytes-hexadecimal-string"
# Example - "7387037c9716a739ae6a80232cfce456"
Expand Down
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
FROM node:14-alpine as app
FROM node:14-alpine

WORKDIR /app
COPY ./ ./

RUN npm install
RUN npm run build
ENV SECRETS_KEY=
ENV SECRETS_IV=

EXPOSE 3000

RUN apk --update add redis

COPY ./start.sh ./
RUN chmod +x ./start.sh

Expand Down
2 changes: 1 addition & 1 deletion lib/redis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Redis from 'ioredis';

const client = new Redis();
const client = new Redis(process.env.REDIS_URL);

export default client;
10 changes: 2 additions & 8 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#!/bin/bash
#!/bin/sh

/usr/bin/redis-server &
npm run start &

# Wait for any process to exit
wait -n
# Exit with status of process that exited first
exit $?
npx prisma migrate deploy && npm run start

0 comments on commit cd2149f

Please sign in to comment.