Skip to content

Commit 1f08c3e

Browse files
committed
Add Docker setup
1 parent 0dafdaf commit 1f08c3e

File tree

6 files changed

+55
-47
lines changed

6 files changed

+55
-47
lines changed

Diff for: .dockerignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
**/node_modules/
2+
**/build/
3+
**/dist/
4+
**/.next/
5+
**/tsconfig.tsbuildinfo
6+
7+
**/Dockerfile*
8+
**/.dockerignore
9+
10+
**/*.log
11+
**/.env*
12+
13+
**/coverage-summary

Diff for: .github/workflows/deploy_staging.yml

-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@ jobs:
2121
deploy_port: 229
2222
secrets:
2323
SSH_PRIVATE_KEY: ${{ secrets.STAGING_KEY }}
24-
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
25-
VAULT_AUTH_METHOD: ${{ secrets.VAULT_AUTH_METHOD }}
26-
VAULT_AUTH_ROLE_ID: ${{ secrets.VAULT_AUTH_ROLE_ID }}
27-
VAULT_AUTH_SECRET_ID: ${{ secrets.VAULT_AUTH_SECRET_ID }}

Diff for: .secrets

-4
This file was deleted.

Diff for: Dockerfile

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM node:20.10.0-bookworm AS base
2+
WORKDIR /app
3+
ENV PNPM_HOME="/pnpm"
4+
ENV PATH="$PNPM_HOME:$PATH"
5+
RUN corepack enable
6+
7+
# # # PROJECT
8+
FROM base as project
9+
COPY . .
10+
11+
# # # PROD DEPENDENCIES
12+
FROM project AS prod-dependencies
13+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile --ignore-scripts
14+
15+
# # # BUILDER
16+
FROM project AS builder
17+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --ignore-scripts
18+
19+
ARG NEXT_PUBLIC_BUGSNAG_API_KEY
20+
21+
RUN pnpm build
22+
23+
# # # RUNNER
24+
FROM base AS runner
25+
COPY --from=prod-dependencies /app/node_modules /app/node_modules
26+
27+
COPY --from=builder /app/.next/standalone/ /app/.next/standalone
28+
COPY --from=builder /app/.next/static /app/.next/standalone/.next/static
29+
COPY --from=builder /app/public /app/.next/standalone/public
30+
31+
CMD ["node", ".next/standalone/server.js"]

Diff for: README.md

-39
Original file line numberDiff line numberDiff line change
@@ -66,45 +66,6 @@ Project repository
6666

6767
- [Infinum Handbook - Branching](https://infinum.com/handbook/frontend/git/branching)
6868

69-
## Secrets
70-
71-
### Installation
72-
73-
You need to install `secrets_cli` gem. Explained [here](https://github.com/infinum/secrets_cli)
74-
75-
`gem install secrets_cli`
76-
77-
### Configuration
78-
79-
Create a new token on [GitHub](https://github.com/settings/tokens) with `read:org` permissions.
80-
81-
Add 3 new environment variables to `.zshrc` file:
82-
83-
```
84-
export VAULT_ADDR=https://vault.byinfinum.co:8200
85-
export VAULT_AUTH_METHOD=github
86-
export VAULT_AUTH_TOKEN={your_github_token}
87-
```
88-
89-
Don't forget to restart your `exec $SHELL`
90-
91-
> Check the [secrets_cli prerequisites](https://github.com/infinum/secrets_cli#prerequisites) section for more details.
92-
93-
### Pull the secrets
94-
95-
Pull the secrets for the specific environment. Explained [here](https://github.com/infinum/secrets_cli#usage)
96-
97-
`secrets pull -e development`
98-
99-
### Vault dashboard
100-
101-
Example link to Vault dashboard:
102-
103-
- [development](https://vault.byinfinum.co:8200/ui/vault/secrets/js/show/js-react-example/development)
104-
- [staging](https://vault.byinfinum.co:8200/ui/vault/secrets/js/show/js-react-example/staging)
105-
106-
You should log in with the GitHub method and use VAULT_AUTH_TOKEN for the token.
107-
10869
## Styleguide
10970

11071
This project is using the styleguide as defined in the [Infinum Handbook](https://infinum.com/handbook/frontend/react/chakra-ui).

Diff for: docker-compose.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
js-react-example:
3+
image: infinum-js-react-example
4+
container_name: infinum-js-react-example
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
env_file:
9+
- ./.env.local
10+
ports:
11+
- '3000:3000'

0 commit comments

Comments
 (0)