Skip to content

Commit 9e5551c

Browse files
committed
#162 WIP
1 parent 6ee7b98 commit 9e5551c

File tree

6 files changed

+58
-3
lines changed

6 files changed

+58
-3
lines changed

docker-compose.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,17 @@ services:
2626

2727
website:
2828
build:
29-
dockerfile: Dockerfile
29+
dockerfile: Dockerfile.dev
3030
context: ./website/
3131
networks:
3232
- code_quiz
33+
restart: always
34+
volumes:
35+
- ./website:/app
36+
- /app/node_modules
37+
- /app/.next
38+
ports:
39+
- "3000:3000"
3340

3441
api:
3542
build:

website/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ EXPOSE 3000
4444

4545
ENV PORT 3000
4646

47-
CMD ["node", "server.js"]
47+
CMD ["node", "server.js"]
48+

website/Dockerfile.dev

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ARG NODE_ENV=dev
2+
NODE_ENV=${NODE_ENV}
3+
4+
FROM node:16-alpine AS deps
5+
RUN apk add --no-cache libc6-compat
6+
WORKDIR /app
7+
8+
COPY package.json yarn.lock* ./
9+
10+
COPY ./infra/docker/scripts ./scripts
11+
RUN chmod +x -Rv ./scripts/
12+
RUN ./scripts/yarn_install.sh
13+
# The below install script will be replaced by yarn_install.sh
14+
RUN yarn install
15+
16+
COPY . .
17+
18+
EXPOSE 3000
19+
ENV PORT 3000
20+
21+
# The below will be replaced by the entry point
22+
CMD ["yarn", "dev"]
23+
24+
ENTRYPOINT ./scripts/entry_point.sh
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
print "ENV mode = ${NODE_ENV}"
2+
3+
# IF NODE_ENV === 'PRODUCTION'
4+
print "Running production build"
5+
yarn build
6+
node server.js
7+
8+
# IF NODE_ENV === 'DEV'
9+
print "Running dev mode for hot reloading"
10+
yarn dev
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
printf "Moving into /app"
3+
cd /app
4+
5+
print "ENV mode = ${NODE_ENV}"
6+
7+
# IF NODE_ENV === 'PRODUCTION'
8+
print "Installing from frozen lockfile"
9+
yarn --frozen-lockfile
10+
11+
# IF NODE_ENV === 'DEV'
12+
print "Installing yarn deps"
13+
yarn install

website/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Home: NextPage = () => {
1414

1515
<main className={styles.main}>
1616
<h1 className={styles.title}>
17-
Welcome to <a href="https://nextjs.org">Next.js!</a>
17+
Welcome to <a href="https://nextjs.org">Code Quiz!</a>
1818
</h1>
1919

2020
<p className={styles.description}>

0 commit comments

Comments
 (0)