This repository has been archived by the owner on Mar 2, 2025. It is now read-only.
-
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.
Start work on containerised application
- Loading branch information
0 parents
commit 5f9933f
Showing
3 changed files
with
65 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,22 @@ | ||
# Base image | ||
FROM node | ||
|
||
# Make folder to put our files in | ||
RUN mkdir -p /usr/src/app | ||
RUN mkdir -p /usr/src/app/backend | ||
|
||
# Set working directory so that all subsequent command runs in this folder | ||
WORKDIR /usr/src/app/backend | ||
|
||
# Copy package json and install dependencies | ||
COPY package*.json ./ | ||
RUN npm install | ||
|
||
# Copy our app | ||
COPY . . | ||
|
||
# Expose port to access server | ||
EXPOSE 8080 | ||
|
||
# Command to run our app | ||
CMD [ "npm", "start"] |
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,28 @@ | ||
version: '3' | ||
|
||
services: | ||
# Create frontend container | ||
frontend: # Name of service | ||
build: ./frontend # Path to Dockerfile | ||
ports: # Port binding to host from Docker container | ||
- "3000:3000" # Bind port 3000 of host to 3000 of container | ||
container_name: frontend-docker | ||
restart: always | ||
links: | ||
- backend | ||
|
||
backend: | ||
build: ./backend | ||
ports: | ||
- "8080:8080" | ||
container_name: backend-docker | ||
restart: always | ||
links: | ||
- database | ||
|
||
database: | ||
image: postgres | ||
ports: | ||
- "5432:5432" | ||
container_name: database-docker | ||
restart: always |
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,15 @@ | ||
# Base image | ||
FROM nginx | ||
|
||
# Make folder to put our files in | ||
RUN mkdir -p /usr/src/app | ||
RUN mkdir -p /usr/src/app/frontend | ||
|
||
# Set working directory so that all subsequent command runs in this folder | ||
WORKDIR /usr/src/app/frontend | ||
|
||
# Copy our app | ||
COPY . . | ||
|
||
# Expose port to access server | ||
EXPOSE 3000 |