-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
340366f
commit e8709ec
Showing
1 changed file
with
45 additions
and
0 deletions.
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,45 @@ | ||
FROM ubuntu:20.04 | ||
SHELL ["/bin/bash", "--login", "-i", "-c"] | ||
|
||
# Update Ubuntu repository | ||
RUN apt-get update | ||
|
||
# Upgrade Ubuntu packages | ||
RUN apt-get upgrade -y | ||
|
||
# Install cURL | ||
RUN apt-get install curl -y | ||
|
||
# Add current working directory to container at /var/www/api | ||
ADD . /var/www/api | ||
|
||
# Setting up our working directory | ||
WORKDIR /var/www/api | ||
|
||
# Read .nvmrc and expose it's content as NODE_VERSION | ||
RUN export NODE_VERSION=$(cat .nvmrc) | ||
|
||
# Installing Node | ||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | ||
RUN source /root/.bashrc && nvm install $NODE_VERSION --default | ||
|
||
# Install globally yarn | ||
RUN npm install yarn --global | ||
|
||
# Install dev packages | ||
RUN rm -Rf ./node_modules | ||
RUN yarn install --frozen-lockfile --production=false | ||
|
||
# Build API | ||
RUN yarn build | ||
|
||
# Reinstall production packages | ||
RUN rm -Rf ./node_modules | ||
RUN yarn install --frozen-lockfile --production=true | ||
|
||
# Delete source files | ||
RUN rm -Rf ./src | ||
|
||
# Export port in:out | ||
EXPOSE 8080:9688 | ||
CMD yarn start |