Skip to content

Commit

Permalink
feat: improve Docker DX
Browse files Browse the repository at this point in the history
  • Loading branch information
johannchopin committed Nov 15, 2024
1 parent 2452356 commit 7a62e1e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 40 deletions.
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node:17-alpine
WORKDIR /app
COPY ./package.json ./yarn.lock /app/
RUN npm install
COPY . /app/
EXPOSE 5000
CMD ["npm", "run", "serve"]
FROM node:alpine
WORKDIR /app
COPY ./package.json ./yarn.lock /app/
RUN npm install
COPY . /app/
EXPOSE 5000
CMD ["npm", "run", "serve"]
64 changes: 32 additions & 32 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
version: "3"
services:
app:
image: johannchopin/stackoverflow-readme-profile
restart: always
ports:
- "5000:5000"
container_name: stackoverflow-readme-profile
depends_on:
- db
environment:
- DB_PORT=${DB_PORT}
- DB_HOST=${DB_HOST}
- DB_USERNAME=${DB_USERNAME}
- DB_PASSWORD=${DB_PASSWORD}
- DB_DATABASE=${DB_DATABASE}

db:
image: postgres
restart: always
container_name: postgres-db
environment:
- POSTGRES_USER=${DB_USERNAME}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_DATABASE}
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data

volumes:
pgdata:
services:
app:
build:
context: .
restart: always
ports:
- "5000:5000"
container_name: stackoverflow-readme-profile
depends_on:
- db
environment:
- DB_PORT=${DB_PORT}
- DB_HOST=db
- DB_USERNAME=${DB_USERNAME}
- DB_PASSWORD=${DB_PASSWORD}
- DB_DATABASE=${DB_DATABASE}

db:
image: postgres
restart: always
container_name: postgres-db
environment:
- POSTGRES_USER=${DB_USERNAME}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_DATABASE}
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data

volumes:
pgdata:
7 changes: 7 additions & 0 deletions website/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:alpine
WORKDIR /app
COPY ./package.json ./yarn.lock /app
RUN yarn
COPY . /app/
EXPOSE 3000
CMD ["npm", "run", "dev"]
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "website",
"version": "0.0.1",
"scripts": {
"dev": "vite dev --port 3000",
"dev": "vite dev --port 3000 --host",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
Expand Down

0 comments on commit 7a62e1e

Please sign in to comment.