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

Added devcontainer #14

Open
wants to merge 1 commit into
base: main
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use the specified base image
FROM mcr.microsoft.com/devcontainers/universal:2-linux

# Install Node.js (example uses Node.js 14, adjust as needed)
ARG NODE_VERSION=16
RUN curl -fsSL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# Install yarn
RUN npm install -g yarn

# Install MongoDB
RUN apt-get update \
&& apt-get install -y gnupg \
&& curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - \
&& echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list \
&& apt-get update \
&& apt-get install -y mongodb-org \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "Phuxpoangshafte dev container",
// Use a Dockerfile to define the container image
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": ["--name", "phuxpoangshafte-dev-container"],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sh .devcontainer/package_install.sh",
"customizations": {
"vscode": {
"extensions": [
"qufiwefefwoyn.inline-sql-syntax",
"VisualStudioExptTeam.vscodeintellicode",
"Zignd.html-css-class-completion",
"cmstead.js-codeformer",
"christian-kohler.path-intellisense",
"esbenp.prettier-vscode",
"mechatroner.rainbow-csv",
"humao.rest-client",
"ms-vscode.vscode-typescript-next",
"infeng.vscode-react-typescript",
"ms-azuretools.vscode-docker"
]
}
}

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
5 changes: 5 additions & 0 deletions .devcontainer/package_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd back
yarn install

cd ../front
yarn install
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
First, make sure that you have docker and mongodb installed on your computer. Then you can run the following to set up the local environment:

```
docker-compose up --build
docker compose up --build
```

The backend runs on port 8000 and the frontend on 3000
Expand All @@ -15,4 +15,7 @@ However, if you want to run the front & backend separately, you can do it by run
```
make install
make run
```
```

### Alternative way using VS code dev containers
You can also dev and run this using [VS code Dev containers](https://code.visualstudio.com/docs/devcontainers/containers). You do this by installing the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension as well as having Docker on your computer (in case you are still running Win10 this might not work). After that you can open the repo in a container using "Dev Containers: Clone a repository in Container Volume..." command from the VS code command palette. Note: No need to clone the repo before that to your computer. This should give you a working development environment. After this you can simply run the same commands above to start the service.
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
version: "3"

services:
back:
restart: always
build:
context: .
args:
REACT_APP_PHUX_YEAR: 2022
REACT_APP_PHUX_YEAR: 2024
ports:
- "8000:8000"
container_name: back_phux
Expand All @@ -22,6 +20,7 @@ services:
- SECRET=kossusmakarbasturmetalkopp2021
depends_on:
- db

db:
container_name: phux-db
image: postgres:16.1-alpine3.18
Expand Down