Skip to content

Commit

Permalink
chore(docker): add compose and update configs
Browse files Browse the repository at this point in the history
  • Loading branch information
tednaaa committed Jul 5, 2023
1 parent 305997c commit e30fa56
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ node_modules
.env
.env.example

.idea
.vscode
.DS_Store

cypress
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
node_modules
.env

*.env
!.env.example

.idea
.vscode
.DS_Store

cypress/assets
Expand Down
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ FROM node:18.15.0-alpine as builder

WORKDIR /app

ENV PATH /app/node_modules/.bin:$PATH
ARG API_URL $API_URL

COPY package-lock.json ./
COPY package.json ./

RUN npm ci --silent

COPY . ./
RUN API_URL=$API_URL npm run build
COPY . .

RUN npm run build

# production
FROM nginx:stable-alpine

COPY --from=builder /app/dist /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ npm ci
```

> Create .env from .env.example and fill credentials
> 🚨 For production use secrets
```
cp .env.example .env
Expand All @@ -18,8 +19,8 @@ cp .env.example .env
npm start
```

> Build your project and minify for production
> Run your production app in background
```
npm run build
docker-compose up -d
```
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- '80:80'
environment:
- PORT=3000
- API_URL=http://localhost:8080

0 comments on commit e30fa56

Please sign in to comment.