-
Notifications
You must be signed in to change notification settings - Fork 96
Simple implementation of Docker for development and production #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
0ccc3a2
30b7ea3
de68a6b
f10ee66
fc53282
8b71ec5
aa65456
b9f03af
cc8e515
b030e68
d6da84a
c0a9337
02652e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/node_modules | ||
/docker | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
.vercel | ||
.gitignore | ||
.github | ||
.next |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
build-development: | ||
docker-compose -f docker/docker-compose.dev.yml build --no-cache | ||
|
||
run-development: | ||
docker-compose -f docker/docker-compose.dev.yml up -d | ||
|
||
stop-development: | ||
docker-compose -f docker/docker-compose.dev.yml down | ||
|
||
build-production: | ||
docker-compose -f docker/docker-compose.prod.yml build --no-cache | ||
|
||
run-production: | ||
docker-compose -f docker/docker-compose.prod.yml up -d | ||
|
||
stop-production: | ||
docker-compose -f docker/docker-compose.prod.yml down |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:14-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY package*.json yarn.lock* ./ | ||
|
||
RUN yarn | ||
|
||
COPY ./ ./ | ||
|
||
CMD ["yarn", "dev"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM node:14-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY package*.json yarn.lock* ./ | ||
|
||
RUN yarn | ||
|
||
COPY ./ ./ | ||
|
||
RUN yarn build | ||
|
||
CMD ["yarn", "start"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
container_name: hacktoberfest_projects_dev | ||
build: | ||
context: ../ | ||
dockerfile: docker/Dockerfile.dev | ||
ports: | ||
- 3000:3000 | ||
volumes: | ||
- ../:/app | ||
- /app/node_modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '3.8' | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I've added the restart property for production, before I've added it for development too but now I've removed it |
||
services: | ||
app: | ||
container_name: hacktoberfest_projects_prod | ||
build: | ||
context: ../ | ||
dockerfile: docker/Dockerfile.prod | ||
ports: | ||
- 3000:3000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try using a slim image instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart of the size and the distro, what's the difference between alpine and slim?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's not much. It's mostly the same, except Alpine is a completely separate distro of it's own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, for development has sense to use slim because being a debian distro there are chances to install any additional package with apt, as for production I prefer to keep it with alpine since the smaller the image the better