-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: dockerizing api * fix: updates per eric
- Loading branch information
1 parent
2c3f4cb
commit c19f18c
Showing
4 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Dockerfile | ||
.dockerignore | ||
node_modules | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
# Base image | ||
FROM node:18 | ||
|
||
# Create working directory | ||
WORKDIR /usr/src/api | ||
|
||
# Copy package.json | ||
COPY package.json ./ | ||
|
||
# Copy yarn.lcok | ||
COPY yarn.lock ./ | ||
|
||
# run yarn install | ||
RUN yarn install | ||
|
||
# Copy source code into docker image | ||
COPY . . | ||
|
||
# Copy .env | ||
COPY .env ./ | ||
|
||
# run build commands | ||
RUN yarn prisma generate | ||
RUN yarn build | ||
|
||
# Expose port 3100 for api | ||
EXPOSE 3100 | ||
|
||
# Start api | ||
CMD ["yarn", "dev"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
services: | ||
api: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
container_name: api | ||
environment: | ||
- PORT=${PORT} | ||
ports: | ||
- '3100:3100' | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters