Skip to content
This repository has been archived by the owner on Mar 2, 2025. It is now read-only.

Commit

Permalink
Start work on containerised application
Browse files Browse the repository at this point in the history
  • Loading branch information
robiworks committed Dec 29, 2021
0 parents commit 5f9933f
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
22 changes: 22 additions & 0 deletions backend/Dockerfile
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"]
28 changes: 28 additions & 0 deletions docker-compose.yml
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
15 changes: 15 additions & 0 deletions frontend/Dockerfile
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

0 comments on commit 5f9933f

Please sign in to comment.