-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev/docker' into dev/dockers
- Loading branch information
Showing
7 changed files
with
118 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash -x | ||
|
||
# Do I have a UID in the container | ||
echo "Current user: $CURRENT_UID" | ||
if [ -z "$CURRENT_UID" ]; then | ||
CURRENT_UID=33 | ||
fi | ||
|
||
# shellcheck disable=SC2153 | ||
GROUP_NAME=$(id -gn "$CURRENT_UID") | ||
# shellcheck disable=SC2181 | ||
if [ -z "$GROUP_NAME" ]; then | ||
CURRENT_GID=33 | ||
GROUP_NAME=www-data | ||
else | ||
CURRENT_GID=$(id -g "$CURRENT_UID") | ||
fi | ||
|
||
# Do I have a UID in the container | ||
USER_NAME=$(id -un "${CURRENT_UID}") | ||
if [ -z "$USER_NAME" ]; then | ||
echo arcuser:x:${CURRENT_UID}:${CURRENT_GID}::/var/www:/usr/sbin/nologin >> /etc/passwd | ||
USER_NAME=arcuser | ||
pwconv | ||
fi | ||
|
||
echo "Setting permission to $USER_NAME:$GROUP_NAME" | ||
chown -R "${USER_NAME}" /opt/project | ||
umask 0002 | ||
su -c "yarn run cross-env NODE_ENV=development API_BASE=${API_BASE} webpack-dev-server --mode development --open" -s /bin/bash "$USER_NAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Docker | ||
|
||
If you know what you are doing then jump straight to [components](#components) or [configuration](#configuration) sections, otherwise these instruction should get you started. | ||
|
||
1. [Install docker desktop](#install-docker-desktop) | ||
|
||
## Install docker desktop | ||
|
||
Docker containers are available for Windows, Mac and Linux. Install intructions are here: [docker-composer](https://docs.docker.com/compose/install/). This guide will assume you have followed [Scenario one: Install Docker Desktop](https://docs.docker.com/compose/install/#scenario-one-install-docker-desktop). | ||
|
||
## Start the container | ||
|
||
Assuming you have a terminal open and have changed directory to the root of this repo: | ||
|
||
```bash | ||
docker compose up --build | ||
``` | ||
|
||
The container will be ready to use when you see output something like this: | ||
|
||
``` | ||
... | ||
runtime modules 26.6 KiB 12 modules | ||
orphan modules 723 bytes [orphan] 2 modules | ||
javascript modules 1.07 MiB | ||
modules by path ./src/ 207 KiB | ||
modules by path ./src/components/*.vue 46.3 KiB 51 modules | ||
modules by path ./src/pages/*.vue 46.4 KiB 35 modules | ||
modules by path ./src/*.vue 69.8 KiB 8 modules | ||
modules by path ./src/*.js 17.7 KiB 4 modules | ||
modules by path ./src/mixins/*.js 1.74 KiB 4 modules | ||
modules by path ./src/services/*.js 24.9 KiB 2 modules | ||
modules by path ./src/fonts/*.ttf 208 bytes 2 modules | ||
+ 1 module | ||
modules by path ./node_modules/ 882 KiB 92 modules | ||
./fixtures/fixtures.js 7.42 KiB [built] [code generated] | ||
./package.json 1.81 KiB [built] [code generated] | ||
webpack 5.77.0 compiled successfully in 3315 ms | ||
``` | ||
|
||
If you are using Mac, Linux or WSL you can set the server to run as your user, this means that the files written by the project will be owned by you. | ||
|
||
```bash | ||
CURRENT_UID=$(id -u) docker compose up --build | ||
``` | ||
|
||
Logs will appear in the terminal standard out. | ||
|
||
## Wiring it up to ARCVService | ||
|
||
This ARCMarket can be wired up to the ARCVService. Just checkout and start ARCVService, then checkout and start ARCVMarket. | ||
|
||
```bash | ||
git clone [email protected]:neontribe/ARCVService.git | ||
CURRENT_UID=$(id -u) docker compose -f ARCVService/docker-compose.yml up --build -d | ||
git clone [email protected]:neontribe/ARCVMarket.git | ||
CURRENT_UID=$(id -u) docker compose -f ARCVMarket/docker-compose.yml up --build -d | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# See Docker.md for more info... | ||
# docker compose run -u $(id -u):$(id -g) arcmarket | ||
|
||
version: '2.1' | ||
services: | ||
|
||
arcmarket: | ||
build: | ||
context: . | ||
image: neontribe/arcmarket:dev | ||
environment: | ||
API_BASE: "http://arcv-store.test:8000/api" | ||
CURRENT_UID: ${CURRENT_UID} | ||
ports: | ||
- "${ARC_PORT:-8081}:8081" | ||
volumes: | ||
- .:/opt/project | ||
# tty: true | ||
# stdin_open: true | ||
# entrypoint: bash | ||
restart: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters