Skip to content

Commit

Permalink
Add information about Docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb authored and Turbo87 committed Dec 28, 2020
1 parent e5c27bb commit b8d89d4
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 4 deletions.
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.154.0/containers/docker-existing-docker-compose
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
{
"name": "Existing Docker Compose (Extend)",
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../docker-compose.yml",
"docker-compose.yml"
],
// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "api",
// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/home/skylines/code",
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": null
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": []
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",
// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
38 changes: 38 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3.9'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
api:
# If you want add a non-root user to your Dockerfile, you can use the "remoteUser"
# property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks,
# debugging) to execute as the user. Uncomment the next line if you want the entire
# container to run as this user instead. Note that, on Linux, you may need to
# ensure the UID and GID of the container user you create matches your local user.
# See https://aka.ms/vscode-remote/containers/non-root for details.
#
# user: vscode

# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile

# volumes:
# Update this to wherever you want VS Code to mount the folder of your project
# - .:/workspace:cached

# Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details.
# - /var/run/docker.sock:/var/run/docker.sock

# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
# cap_add:
# - SYS_PTRACE
# security_opt:
# - seccomp:unconfined

# Overrides default command so things don't shut down after the process ends.
command: /bin/sh -c "while sleep 1000; do :; done"

62 changes: 62 additions & 0 deletions INSTALL.docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Docker

[docker](http://www.docker.com/) can be used to easily set up a development
environment for *SkyLines*.

The environment configuration is described in [docker-compose.yml](docker-compose.yml).

The same environment is used on github to run the tests.

## Direct usage

If you are familiar with [Docker](http://www.vagrantup.com/), you can use
[docker-compose.yml](docker-compose.yml) to set up your development environment.

## Usage with VSCode

If you are less familiar with Docker, [VSCode](https://code.visualstudio.com/)
makes it easy to bootstrap a development environment to start tinkering with
the *SkyLines* backend code.

All you need to do is install [docker](http://www.vagrantup.com/),
[VSCode](https://code.visualstudio.com/) and the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).

Check [the documentation](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
for detailed instructions. You can also check a [tutorial](https://docs.microsoft.com/en-us/learn/modules/use-docker-container-dev-env-vs-code/2-use-as-development-environment).

Once you have everything installed you can run the
`Remote-Containers: ReOpen in Container...` command, and your workspace will be
re-opened from inside the container.

## Running tests

To execute the unit tests, launch:

```
root@xxx:/home/skylines/code# pipenv run py.test -vv
```

You can restrict the unit tests to run by passing a file or a folder:

```
pipenv run py.test -vv tests/api/views/clubs/
```

See the [pytest documentation](https://docs.pytest.org/en/stable/contents.html)
for more details.

## Frontend installation

The frontend is based on Ember.js. It is recommended to build the frontend on
the host machine directly for improved performance.

* Install [Node.js](https://nodejs.org/) and [bower](https://bower.io/)

Now you can start and build the frontend:

```
cd ember
npm install
bower install
node_modules/.bin/ember build
```
7 changes: 3 additions & 4 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ our developers use Ubuntu or Debian too. We recommend to use either one of
those systems for development, but it may also be possible to make it work on
OS X or Windows.

There is also a [Vagrant](http://www.vagrantup.com/) environment for
*SkyLines*. This makes it possible to run a virtual machine with Ubuntu
dedicated to *SkyLines* development on OS X or Windows. More information
can be found in [INSTALL.vagrant.md](INSTALL.vagrant.md).
There is also a [Docker](http://www.docker.com/) environment for *SkyLines*.
This makes it possible to run a containerized *SkyLines* development
environment. More information can be found in [INSTALL.docker.md](INSTALL.docker.md).


## Python, Flask and other dependencies
Expand Down

0 comments on commit b8d89d4

Please sign in to comment.