Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
refactor docker-compose and Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mgilangjanuar committed Mar 11, 2022
1 parent d2150bd commit b540d37
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 15 deletions.
20 changes: 11 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
FROM node:14.19.0 as build
ARG NPM_TOKEN
ARG BUILD_CONTEXT

WORKDIR /apps
COPY package.json .

COPY yarn.lock .
COPY ./package.json .
COPY $BUILD_CONTEXT/package.json .
RUN echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc && \
echo "@mgilangjanuar:registry=https://npm.pkg.github.com/" >> ~/.npmrc && \
yarn install && \
rm -f ~/.npmrc && \
npm i react-scripts -g && \
npm i typescript -g
COPY . .
RUN yarn workspaces run build
echo "@mgilangjanuar:registry=https://npm.pkg.github.com/" >> ~/.npmrc
RUN npm i react-scripts -g --silent && \
npm i typescript
RUN yarn install
RUN rm -f ~/.npmrc
COPY $BUILD_CONTEXT .
RUN yarn run build
5 changes: 4 additions & 1 deletion docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ MIDTRANS_SERVER_KEY=

UTILS_API_KEY=

DISABLE_PAYMENT_CHECK=
DISABLE_PAYMENT_CHECK=

REACT_APP_TG_API_ID=
REACT_APP_TG_API_HASH=
27 changes: 23 additions & 4 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ services:
ports:
- "80:80"
depends_on:
- app
app:
command: yarn server start
- server
- web
server:
command: yarn start
labels:
traefik.http.routers.server.rule: Host(`teledrive.localhost`)
traefik.http.routers.server.rule: Host(`server.localhost`)
traefik.port: 4000
expose:
- 4000
build:
context: ../.
dockerfile: Dockerfile
args:
BUILD_CONTEXT: server
NPM_TOKEN: ${NPM_TOKEN}
environment:
DB_NAME: postgres
Expand All @@ -38,6 +40,23 @@ services:
depends_on:
- db
- cache
web:
command: yarn start
labels:
traefik.http.routers.web.rule: Host(`teledrive.localhost`)
traefik.port: 3000
expose:
- 3000
build:
context: ../.
dockerfile: Dockerfile
args:
BUILD_CONTEXT: web
NPM_TOKEN: ${NPM_TOKEN}
environment:
REACT_APP_API_URL: http://server.localhost
depends_on:
- server
db:
image: postgres:13
restart: always
Expand Down
4 changes: 3 additions & 1 deletion web/.env-example
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
REACT_APP_API_URL=http://localhost:4000
REACT_APP_API_URL=http://localhost:4000
REACT_APP_TG_API_ID=
REACT_APP_TG_API_HASH=

0 comments on commit b540d37

Please sign in to comment.