Skip to content
Browse files

Replace Alpine by Debian stretch slim for Docker local dev (#3253)

* Replace Alpine by Debian stretch slim

* DevContainer configuration for VSCode (#3295)

* Replace Alpine by Debian stretch slim

* devcontainer!

* custom dockerfile for devcontainer

* update runserver

* install ssh

* switch the approach to using a container just for intellisense instead of trying to run services inside vscode

* docs

* Update docs/

Co-Authored-By: Alan Mooiman <>

* doc update
  • Loading branch information...
patjouk committed Jul 3, 2019
1 parent 210684e commit 6b7be5bbf2aed782765c65e087310d0aebbdb551
@@ -0,0 +1,13 @@
"name": "Mozilla Foundation CMS",
"dockerFile": "../dockerfiles/Dockerfile.python",
"context": "..",
"extensions": [
"settings": {
"": "bash",
"python.pipenvPath": "/usr/local/bin/pipenv",
"python.linting.flake8Path": "flake8"
@@ -1,14 +1,10 @@
FROM node:8-alpine
FROM node:8-stretch-slim


# Copy package files in the container
COPY package.json package-lock.json ./

RUN apk add --no-cache \
zlib-dev \

RUN npm install

# Install visual testing tools separately with CI true to suppress the hundreds lines of "unziping".
@@ -1,4 +1,4 @@
FROM python:3.7-alpine
FROM python:3.7-slim

# We want output


# Install dependencies for pillow and psycopg
RUN apk add --no-cache \
build-base \
jpeg-dev \
zlib-dev \
postgresql-dev \

# Install pipenv
RUN pip install pipenv

@@ -2,6 +2,7 @@

This documentation is composed of three main sections:
- [How to install and use Docker for local development](./
- [Connecting Docker to your code editor](./
- [Docker 101 and how we use it with the foundation site](./ Start here if you're new to Docker
- [FAQ](./

@@ -86,6 +87,30 @@ Use `invoke docker-npm update`.
You don't need to rebuild the `watch-static-files` image.


## Connecting Docker to your code editor

### Pycharm

This feature is only available for the professional version of Pycharm. Follow the official instructions [available here](

### Visual Studio Code

Visual Studio Code use a feature called Dev Container to run Docker projects. The configuration files are in the `.devconatainer` directory. This feature is only available starting VSCode 1.35 stable. For now, we're only creating a python container to get Intellisense, we're not running the full project inside VSCode. We may revisit this in the future if Docker support in VSCode improves.

A few things to keep in mind when using that setup:
- Do not use the terminal in VSCode when running `invoke docker-` commands: use a local terminal instead,
- when running `inv docker-catchup` or installing python dependencies, you will need to rebuild the Dev Container. To do that, press `F1` and look for `Rebuild Container`.

#### Instructions:

- Install the [Remote - containers extension](,
- Open the project in VSCode: it detects the Dev Container files and a popup appears: click on `Reopen in a Container`,
- Wait for the Dev Container to build,
- Work as usual and use the docker invoke commands in a terminal outside VSCode.


## Docker vocabulary and overview
@@ -111,8 +136,8 @@ I would recommend watching [An Intro to Docker for Djangonauts](https://www.yout
All our containers run on Linux.

For local development, we have two Dockerfiles that define our images:
- `Dockerfile.node`: use a node8-alpine base image from the Docker Hub and install node dependencies,
- `Dockerfile.python`: use a python3.6-alpine base image, install required build dependencies before installing pipenv and the project dependencies.
- `Dockerfile.node`: use a node8 Debian Stretch slim base image from the Docker Hub and install node dependencies,
- `Dockerfile.python`: use a python3.7 Debian Stretch slim base image, install required build dependencies before installing pipenv and the project dependencies.
We don't have a custom image for running postgres and use one from the Docker Hub.

The `docker-compose.yml` file describes the 3 services that the project needs to run:
@@ -51,7 +51,7 @@ def manage(ctx, command, option=None, flag=None):
def runserver(ctx):
"""Start a web server"""
manage(ctx, "runserver")
manage(ctx, "runserver")


0 comments on commit 6b7be5b

Please sign in to comment.
You can’t perform that action at this time.