Skip to content

Commit

Permalink
Add Dockerfile and devcontainer configuration (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
akdasa authored Dec 16, 2023
1 parent ee89c32 commit 3b15e58
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 7 deletions.
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM mcr.microsoft.com/playwright:v1.33.0-focal

ARG USERNAME=user
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Install necessary apps
RUN apt-get update && apt-get install -y git fish sudo

# Create the user
RUN groupadd --gid ${USER_GID} ${USERNAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}
USER ${USERNAME}

# Copy files
WORKDIR /workspaces
COPY --chown=${USER_UID}:${USER_GID} . .
RUN npm install

# Infinite development loop
CMD ["/bin/bash", "-c", "while true; sleep 1000; done"]
18 changes: 18 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Shlokas E2E",
"dockerComposeFile": [
"docker-compose.yml"
],
"service": "e2e",
"workspaceFolder": "/workspaces",
"customizations": {
"vscode": {
"extensions": [
"TakumiI.markdowntable",
"yzhang.markdown-all-in-one",
"darkriszty.markdown-table-prettify",
"ms-azuretools.vscode-docker"
]
}
}
}
21 changes: 21 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: shlokas
version: '3'

services:
e2e:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
args:
- USER_UID=${UID:-1003}
- USER_GID=${UID:-1003}
expose:
- 8080
networks:
- shlokas
volumes:
- ..:/workspaces

networks:
shlokas:
name: shlokas
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@ This repository contains the end-to-end tests for the Shlokas mobile app. The te
<p align="center">
<a href="https://github.com/akdasa-studios/shlokas-e2e/actions/workflows/tests-nightly.yml"><img src="https://github.com/akdasa-studios/shlokas-e2e/actions/workflows/tests-nightly.yml/badge.svg?event=schedule" alt="Tests"></a>
</p>


## Environment variables
| Variable | Default | Descriptiion |
| ----------- | --------------------- | --------------------------------- |
| SHLOKAS_URL | http://localhost:8080 | Url to run tests against for |
| MAIL_URL | http://localhost:1080 | Url for real or fake mail service |

## Run tests
You can run tests against specific urls:
```sh
SHLOKAS_URL=http://app:8080 MAIL_URL=http://mail:1080 npm run tests
```
8 changes: 2 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "playwright test"
"test": "playwright test",
"test:dev": "SHLOKAS_URL=http://shlokas:8080 playwright test"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 3b15e58

Please sign in to comment.