Skip to content

Commit

Permalink
Merge pull request #23 from acmutd/internal/docker
Browse files Browse the repository at this point in the history
Internal/docker
  • Loading branch information
harshasrikara authored Mar 27, 2021
2 parents bd07c81 + 4859f51 commit 06e700a
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.github
.idea
build/
node_modules/
/node_modules
.DS_Store
33 changes: 33 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish Docker image
on:
release:
types: [published]
push:
branches:
- master
- dev
pull_request:
branches: [dev]

jobs:
push_to_registries:
name: Push Docker Image to DockerHub and Github Packages
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: acmutd/portal
tag_with_ref: true
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: acmutd/portal/portal
tag_with_ref: true
15 changes: 15 additions & 0 deletions .nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
worker_processes 4;

events { worker_connections 1024; }

http {
server {
listen 3000;
root /usr/share/nginx/html;
include /etc/nginx/mime.types;

location /appui {
try_files $uri /index.html;
}
}
}
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# stage1 as builder
FROM node:alpine as builder

# copy the package.json to install dependencies
COPY package.json package-lock.json ./

# Install the dependencies and make the folder
RUN npm install && mkdir /react-ui && mv ./node_modules ./react-ui

WORKDIR /react-ui

COPY . .

# Build the project and copy the files
RUN npm run build


FROM nginx:alpine

#!/bin/sh

COPY ./.nginx/nginx.conf /etc/nginx/nginx.conf

## Remove default nginx index page
RUN rm -rf /usr/share/nginx/html/*

# Copy from the stahg 1
COPY --from=builder /react-ui/build /usr/share/nginx/html

EXPOSE 3000 3000

ENTRYPOINT ["nginx", "-g", "daemon off;"]
11 changes: 11 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:alpine

WORKDIR /app

COPY package.json /app

RUN npm install

COPY . /app

CMD ["npm", "run", "dev"]
12 changes: 12 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3.8"
services:
client:
stdin_open: true
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
volumes:
- "/app/node_modules"
- "./:/app"
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.8"
services:
portal:
stdin_open: true
image: acmutd/portal:latest
ports:
- "3000:3000"
3 changes: 3 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!bin/bash

npm start

0 comments on commit 06e700a

Please sign in to comment.