Skip to content

Commit

Permalink
refactor: Dockerfile + docker-compose + fix mobile sidebar close on c…
Browse files Browse the repository at this point in the history
…lick
  • Loading branch information
sjdonado committed Nov 26, 2023
1 parent 5cb6547 commit 03da658
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 37 deletions.
33 changes: 9 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
FROM node:20-alpine AS base
WORKDIR /usr/src/app
RUN apk update && apk upgrade npm

# Install dependencies
FROM base as deps

WORKDIR /app

ADD package*.json .

FROM base as install
COPY package.json package-lock.json .
RUN npm ci

# Build the app
FROM base as build

FROM install AS prerelease
ENV NODE_ENV=production

WORKDIR /app

COPY --from=deps /app/node_modules /app/node_modules
COPY --from=install /usr/src/app/node_modules node_modules
ADD . .

RUN npm run build

# Production image
FROM base

FROM base AS release
ENV NODE_ENV=production
COPY --from=prerelease /usr/src/app .

WORKDIR /app

COPY --from=build /app .

EXPOSE 3000

EXPOSE 3000/tcp
CMD ["npm", "run", "start"]
2 changes: 1 addition & 1 deletion app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function Header({ username }: HeaderProps) {
>
<Bars3Icon className="h-6 w-6" />
</label>
<div className="flex items-center justify-center gap-1">
<div className="flex items-center justify-center ms:gap-1">
<label className="btn btn-ghost rounded-lg swap swap-rotate">
<input type="checkbox" className="theme-controller" value="dark" />
<SunIcon className="swap-off fill-current w-6 h-6" />
Expand Down
5 changes: 4 additions & 1 deletion app/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export default function Sidebar({ userSessionRole, children }: SidebarProps) {
{[adminRole, teacherRole].includes(
userSessionRole as typeof adminRole | typeof teacherRole
) && (
<li className="bg-base-200/40 rounded-lg">
<li
className="bg-base-200/40 rounded-lg"
onClick={() => (document.activeElement as HTMLInputElement).blur()}
>
<NavLink
to="assignments"
className={({ isActive, isPending }) =>
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: '3.9'
services:
# app:
# build: .
# env_file: .env
# ports:
# - 3333:3333
app:
build: .
env_file: .env
ports:
- 3333:3333
db:
image: postgres:latest
restart: always
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 03da658

Please sign in to comment.