Commit 12c63108 authored by Zac Wood's avatar Zac Wood

Added Docker and CI for web. Added init.sh file to start developing

with one command
parent e46e5b81
Pipeline #2650 passed with stage
in 2 minutes and 25 seconds
stages:
- test_api
- test
api:
test_api:
image: ruby:2.5
stage: test_api
stage: test
script:
- cd schedules_api
- bundle install
- rails db:migrate
- rails test
test_web:
image: node:9
stage: test
script:
- cd schedules_web
- yarn
- yarn build
\ No newline at end of file
......@@ -7,4 +7,12 @@ services:
- "3000:3000"
command: ./start.sh
volumes:
- .:/api
- ./schedules_api:/api
web:
image: schedules_web
ports:
- "8080:8080"
command: yarn start
volumes:
- ./schedules_web:/web
#! /bin/bash
cd schedules_api/
docker build . -t 'schedules_api'
cd ../schedules_web
docker build . -t 'schedules_web'
cd ..
docker-compose up -d
docker-compose exec api rails db:seed
......@@ -4,4 +4,7 @@ RUN mkdir /api
WORKDIR /api
ADD . /api
EXPOSE 3000
RUN bundle install
RUN rails db:migrate
......@@ -7,8 +7,8 @@ export SECRET_KEY_BASE=$(rails secret)
#cp db/development.sqlite3 db/production.sqlite3
# load data from patriot web into database
# rails db:migrate
# rails db:seed
rails db:migrate
rails db:seed
# start the server
rails s
FROM node:9
RUN mkdir /web
WORKDIR /web
ADD . /web
EXPOSE 8080
RUN yarn
\ No newline at end of file
const path = require('path');
const webpack = require('webpack');
const path = require("path");
const webpack = require("webpack");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: "./index.html",
filename: "index.html",
inject: "body"
inject: "body",
});
module.exports = {
mode: "development",
devtool: 'source-map',
devtool: "source-map",
entry: './src/index.tsx',
entry: "./src/index.tsx",
output: {
filename: '[name].[hash].js',
path: path.resolve(__dirname, 'dist'),
filename: "[name].[hash].js",
path: path.resolve(__dirname, "dist"),
},
resolve: {
extensions: ['.js', '.json', '.ts', '.tsx'],
extensions: [".js", ".json", ".ts", ".tsx"],
},
module: {
rules: [{
rules: [
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader',
loader: "awesome-typescript-loader",
exclude: /node_modules/,
},
{
enforce: 'pre',
enforce: "pre",
test: /\.js$/,
loader: 'source-map-loader'
loader: "source-map-loader",
},
{
test: /\.css$/,
use: [{
loader: "style-loader"
use: [
{
loader: "style-loader",
},
{
loader: "css-loader"
}
]
loader: "css-loader",
},
],
},
{
test: /\.woff(\?.+)?$/,
use: 'url-loader?limit=10000&mimetype=application/font-woff'
use: "url-loader?limit=10000&mimetype=application/font-woff",
},
{
test: /\.woff2(\?.+)?$/,
use: 'url-loader?limit=10000&mimetype=application/font-woff'
use: "url-loader?limit=10000&mimetype=application/font-woff",
},
{
test: /\.ttf(\?.+)?$/,
use: 'file-loader'
use: "file-loader",
},
{
test: /\.eot(\?.+)?$/,
use: 'file-loader'
use: "file-loader",
},
{
test: /\.svg(\?.+)?$/,
use: 'file-loader'
use: "file-loader",
},
{
test: /\.(js)$/,
exclude: /(node_modules)/,
loader: "babel-loader"
loader: "babel-loader",
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new CleanWebpackPlugin(["dist"]),
HtmlWebpackPluginConfig
],
plugins: [new webpack.HotModuleReplacementPlugin(), new CleanWebpackPlugin(["dist"]), HtmlWebpackPluginConfig],
devServer: {
contentBase: path.resolve(__dirname, "dist"),
compress: true,
host: "0.0.0.0",
port: 8080,
hot: true,
publicPath: "/",
historyApiFallback: true
}
historyApiFallback: true,
},
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment