-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new Docker images to split dev and production environments
- Loading branch information
1 parent
3f793e5
commit 7029069
Showing
6 changed files
with
91 additions
and
51 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 |
---|---|---|
|
@@ -8,4 +8,5 @@ | |
**/Dockerfile | ||
**/docker-* | ||
**/CODEOWNERS | ||
**/LICENSE | ||
**/LICENSE | ||
**/next-env.d.ts |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
# misc | ||
.DS_Store | ||
*.pem | ||
/docker/database/ | ||
/docker-compose.override.yml | ||
|
||
# debug | ||
npm-debug.log* | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Use an customized image of Node.js | ||
# https://hub.docker.com/_/node | ||
FROM node:lts-alpine | ||
|
||
# Add cURL for health check and OpenSSL for generating random secret | ||
RUN apk update && apk add --no-cache curl openssl | ||
|
||
# Set the working directory to the website files | ||
WORKDIR /usr/src/app | ||
|
||
# Change permissions of the working directory | ||
RUN chown node:node . | ||
|
||
# Copy all files required to build the project | ||
COPY --chown=node:node . . | ||
|
||
# Create a directory for the Next.js build cache | ||
RUN mkdir -p .next && chown -R node:node .next | ||
|
||
# Install all dependencies | ||
# Use cache mount to speed up installation of existing dependencies | ||
RUN --mount=type=cache,target=.npm \ | ||
npm set cache .npm && \ | ||
npm install && chown -R node:node ./node_modules | ||
|
||
# Add wait script to wait for other services to be ready | ||
ADD https://github.com/ufoscout/docker-compose-wait/releases/latest/download/wait /wait | ||
RUN chmod +x /wait | ||
|
||
# Use non-root user | ||
USER node | ||
|
||
# Find and replace some default environment variables | ||
RUN sed -i "s#AUTH_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#AUTH_SECRET=$(openssl rand -base64 32)#g" .env | ||
|
||
# Create a custom entrypoint script | ||
RUN echo "/wait && npm run migrate && npm run dev" > docker/entrypoint.sh && chmod +x docker/entrypoint.sh | ||
|
||
CMD ["docker/entrypoint.sh"] |
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