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 Dockerfile #1279

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM node:18 as builder

WORKDIR /app

# required to run yarn to instsall dependencies
COPY package.json yarn.lock tsconfig.base.json ./
COPY scripts/ ./scripts
COPY linting/ ./linting
COPY src/app/package.json src/app/tsconfig.json ./src/app/
COPY src/site/pages/landing/package.json src/site/pages/landing/tsconfig.json ./src/site/pages/landing/
COPY src/site/pages/digital/package.json src/site/pages/digital/tsconfig.json ./src/site/pages/digital/
COPY src/site/pages/analog/package.json src/site/pages/analog/tsconfig.json ./src/site/pages/analog/
COPY src/site/pages/docs/package.json ./src/site/pages/docs/
COPY src/site/shared/package.json src/site/shared/tsconfig.json ./src/site/shared/
RUN yarn

# copy real source code
COPY src/ ./src
RUN yarn run build:prod

FROM golang:latest as server_builder

WORKDIR /app
COPY --from=builder /app/build /app
RUN go build -o /opencircuit

# actual container
FROM ubuntu:latest

WORKDIR /app
COPY --from=server_builder /opencircuit /app/opencircuit
COPY --from=server_builder /app/site /app/site
COPY --from=server_builder /app/data /app/data

ENTRYPOINT ["/app/opencircuit", "--sqlitePath", "/app/data/sql/sqlite/"]
16 changes: 16 additions & 0 deletions docs/GettingStarted/Running.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,19 @@ Convenientally, eslint supports automatically fixing some issues. To do this, ru
```bash
yarn lint:fix
```

### Docker

To run OpenCircuits in docker, you need to build docker image from repository by running
```bash
docker build --rm -t opencircuits .
```

After image created, you simply start container by running
```bash
docker run -p 8080:8080 opencircuits
```

You can change `8080:8080` to expose different port from container.

For example, to expose port 8081 from container, use `8081:8080`