Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Dockerfile #48

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
logs
*.log
npm-debug.log*
.DS_Store

coverage
node_modules
build
.env.local
.env.development.local
.env.test.local
.env.production.local

Dockerfile
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM node:10-alpine3.11 AS base

WORKDIR /app

# I dont know why, but when doing npm install in this Dockerfile, methone just gets cloned but there
# is no dist directory, which makes the build fail since there is nothing in methone to import.
# Also: cd:ing into node_modules/methone and running `npm i && npm run build` doesn't.
FROM base as methone-builder

RUN apk add git
RUN git clone https://github.com/datasektionen/methone .
RUN npm i
RUN npm run build

FROM base as builder

RUN apk add git
COPY package.json package-lock.json ./
RUN npm i
COPY --from=methone-builder /app/dist ./node_modules/methone/dist

COPY bin bin
COPY public public
COPY src src
COPY razzle.config.js .

ENV NODE_ENV=production
ARG RAZZLE_TAITAN_URL
ARG RAZZLE_CALYPSO_URL

RUN npm run build

FROM base

COPY --from=builder /app/package.json /app/package-lock.json ./
COPY --from=builder /app/node_modules node_modules
COPY --from=builder /app/build build

CMD ["npm", "start"]
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
BAWANG
======
# BAWANG

Universal react application for the chapter website.

Running
-------
Bawang runs on Node v.10.x.x. It doesn't work on later versions (v.12.20.1)

`npm start:dev` will start the whole universal server in development mode. HMR will be enabled on both server and client side!
## Environment variables

`npm run build` will build a production ready server.
| Name | Default | Description |
|--------------------|--------------------------------------|-----------------------------------------------------------------------------------------------------|
| TAITAN_URL | https://taitan.datasektionen.se | URL to get contents from taitan on |
| RAZZLE_TAITAN_URL | https://taitan.datasektionen.se | URL to get contents from taitan on. **Set during build**. Should probably be the same as TAITAN_URL |
| RAZZLE_CALYPSO_URL | https://calypso.datasektionen.se/api | URL to get news from calypso on. **Set during build** |
| PORT | 3000 | Port to listen on |

`npm run start` will start the production server.
## Running
Bawang runs on Node v.10.x.x. It doesn't work on later versions (v.12.20.1)

TODO
----
- Fix frontpage styling
- Feature complete news page
- Improve translation implementation
- Add more content providers, i.e. skywhale, pandora
- Write a more helpful README
- `npm start:dev` will start the whole universal server in development mode. HMR will be enabled on both server and client side!
- `npm run build` will build a production ready server.
- `npm start` will start the production server.
Loading