Skip to content

Commit

Permalink
Merge pull request #2 from muhammadjufry/feat/setup-docker
Browse files Browse the repository at this point in the history
feat: setup docker
  • Loading branch information
muhammadjufry authored Feb 4, 2024
2 parents a4ee244 + c81ba08 commit b05af6c
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/node_modules
*/yarn.lock
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"github-actions.workflows.pinned.workflows": [".github/workflows/release.yml"]
}
34 changes: 34 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3.8'
services:
backend:
container_name: backend
build:
context: ./packages/backend
dockerfile: Dockerfile
develop:
watch:
- path: ./packages/backend
action: rebuild
- path: ./packages/backend
target: /app/backend
action: sync
ports:
- 8080:8080
restart: always
frontend:
container_name: frontend
build:
context: ./packages/frontend
dockerfile: Dockerfile
develop:
watch:
- path: ./packages/frontend
action: rebuild
- path: ./packages/frontend
target: /app/frontend
action: sync
ports:
- 3000:3000
depends_on:
- backend
restart: always
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
"name": "jamalipay",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {},
"scripts": {
"docker:build": "docker-compose -p jamalipay build --no-cache",
"docker:up": "docker-compose -p jamalipay up -d",
"docker:watch": "docker-compose watch",
"docker:down": "docker-compose -p jamalipay down"
},
"keywords": [],
"author": "",
"author": "Muhammad Jufry",
"license": "ISC",
"devDependencies": {
"@semantic-release/git": "^10.0.1",
Expand Down
15 changes: 15 additions & 0 deletions packages/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:latest

WORKDIR /app
COPY package.json package*.json ./
ENV PORT=8080

RUN npm install

EXPOSE 8080

# RUN adduser -ms /bin/bash -u 1001 app
# USER app
COPY . .

CMD [ "npm", "run", "dev" ]
3 changes: 3 additions & 0 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,6 @@ server.listen(PORT, () => {
});

app.use("/api/v1", router);
app.get("/", (req, res) => {
res.send("Helo world.");
});
12 changes: 12 additions & 0 deletions packages/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:latest

WORKDIR /app
COPY package.json package*.json ./

RUN npm install

EXPOSE 3000

COPY . .

CMD [ "npm", "run", "dev" ]
3 changes: 1 addition & 2 deletions packages/frontend/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { IconArrowRight } from "@tabler/icons-react";
import Image from "next/image";
import { motion } from "framer-motion";
import { useTheme } from "next-themes";
import { useEffect, useState } from "react";
export default function Hero() {
const { resolvedTheme } = useTheme();
return (
Expand All @@ -14,7 +13,7 @@ export default function Hero() {
transition={{ duration: 0.5 }}
className="!text-sky-500 text-[17.5px]"
>
Build product for everyone
Build product for
</motion.span>
<motion.h2
initial={{ y: -20, opacity: 0 }}
Expand Down

0 comments on commit b05af6c

Please sign in to comment.