Skip to content

Commit 5d5af68

Browse files
authored
Merge pull request #16 from blue-core-lod/gh-publish-action
Publish Blue Core Sinopia Image and Proxy Support
2 parents 5db3b76 + 6177c15 commit 5d5af68

File tree

5 files changed

+33
-25
lines changed

5 files changed

+33
-25
lines changed

.github/workflows/publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Build and Release Docker Image
2+
3+
on:
4+
release:
5+
types:
6+
published
7+
8+
jobs:
9+
build_and_publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Build and push Docker image
16+
run: |
17+
docker login --username blue-core-lod --password ${{ secrets.GITHUB_TOKEN }} ghcr.io
18+
docker build . --tag ghcr.io/blue-core-lod/sinopia:latest
19+
docker push ghcr.io/blue-core-lod/sinopia:latest

Dockerfile

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,29 @@
1-
FROM cimg/node:16.8
1+
FROM node:16.8
22

33
# Allow build-time arguments (for, environment variables that need to be encoded into the webpack distribution)
44
ARG USE_FIXTURES
5-
ARG SINOPIA_API_BASE_URL=http://localhost:3000
6-
ARG SINOPIA_URI
7-
ARG SINOPIA_ENV
8-
ARG AWS_COGNITO_DOMAIN
9-
ARG COGNITO_CLIENT_ID
10-
ARG COGNITO_USER_POOL_ID
5+
ARG SINOPIA_API_BASE_URL=http://localhost/api
6+
ARG SINOPIA_URI=http://localhost/sinopia
7+
ARG SINOPIA_ENV=bluecore
118
ARG INDEX_URL
129
ARG EXPORT_BUCKET_URL
13-
ARG HONEYBADGER_API_KEY
14-
ARG HONEYBADGER_REVISION
15-
ENV HONEYBADGER_API_KEY=$HONEYBADGER_API_KEY
1610

1711
# Set environment variables from the build args
1812
ENV INDEX_URL ${INDEX_URL}
1913

20-
COPY --chown=circleci:circleci package.json .
21-
COPY --chown=circleci:circleci package-lock.json .
14+
COPY package.json .
15+
COPY package-lock.json .
2216

2317
# Install dependencies
2418
RUN npm install --no-optional
2519

2620
# Everything that isn't in .dockerignore ships
27-
COPY --chown=circleci:circleci . .
21+
COPY . .
2822

2923
# Build the app *within* the container because environment variables are fixed at build-time
3024
RUN npm run build
3125

32-
# Send source map to HB
33-
RUN if [ -n "$HONEYBADGER_API_KEY" ]; then curl https://api.honeybadger.io/v1/source_maps \
34-
-F api_key=$HONEYBADGER_API_KEY \
35-
-F revision=$HONEYBADGER_REVISION \
36-
-F minified_url=$SINOPIA_URI/dist/bundle.js \
37-
-F source_map=@dist/bundle.js.map \
38-
-F minified_file=@dist/bundle.js ; fi
39-
4026
# docker daemon maps app's port
41-
EXPOSE 8000
27+
EXPOSE 8004
4228

4329
CMD ["npm", "start"]

server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import Config from "./src/Config"
1111
import cors from "cors"
1212
import proxy from "express-http-proxy"
1313

14-
const port = 8000
14+
const port = 8004
1515
const app = express()
1616

17+
app.set('trust proxy', true);
18+
1719
app.use(express.urlencoded({ extended: true })) // handle URL-encoded data
1820

1921
app.use(cors())

src/components/RootContainer.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Provider } from "react-redux"
88
import CanvasMenu from "./menu/CanvasMenu"
99
import App from "./App"
1010
import store from "../store"
11+
import Config from "../Config"
1112
import { KeycloakProvider } from "../KeycloakContext"
1213
import HoneybadgerNotifier from "Honeybadger"
1314
import { HoneybadgerErrorBoundary } from "@honeybadger-io/react"
@@ -29,7 +30,7 @@ const RootContainer = () => {
2930
effect={"overlay"}
3031
>
3132
<OffCanvasBody className={offcanvasClass}>
32-
<BrowserRouter>
33+
<BrowserRouter basename="/sinopia">
3334
<Provider store={store}>
3435
<App
3536
isMenuOpened={isMenuOpened}

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module.exports = {
7070
},
7171
output: {
7272
path: path.join(__dirname, "/dist"),
73-
publicPath: "/dist/",
73+
publicPath: "/sinopia/dist/",
7474
filename: "bundle.js",
7575
},
7676
plugins: [

0 commit comments

Comments
 (0)